0

As I am implementing a website made in Drupal 6 and using Apache Solr search as the search application in the website.

Drupal Version 6.22 Apache Solr Version : 3.6 Apache Solr Module: 6.1.x

Below are the two problems I am facing.

  1. While searching a particular content the business requirement is to search only in the Title field, Body field and in the Terms attached in a node. How can I achieve that? I have used the HOOK_apachesolr_modify_query() in some other purposes. Do I have to mention all the filters here again? like,

mymodule_apachesolr_modify_query(&$query, &$params, $caller) {
   $query->add_filter('title', $keyword);
   $params['fl'] = 'title';
}


  1. The second is that once the contents are being searched as per the requirement I should get the result based on the following algorithm.

1st result = (Match in Title + Match in Body + Match in Terms names) (Keyword present in all)
2nd result = (Match in Title + Match in Terms names) (Keyword only present in title & term names)
3rd result = (Match in Title + Match in Body) (Keyword present in Title & Body)

So I added a boost factor from the Apache Solr admin section as Title = 1.0 Term = 0.50 Body = 0.25

But the ordering is not maintained.

I even also mentioned


function mymodule_apachesolr_modify_query(&$query, &$params, $caller) {
   $params['qf'] = array('taxonomy_names^0.50', 'title^1.00', 'body^0.25');
}

But no effect. Please suggest any ideas. Help me on these issues, I am really stuck here :(

-1

I would suggest you look into the Views module and/or Apache Solr Views. This blog post http://blog.hsl.virginia.edu/drupalpress/apachesolr-views-drupal-6/ might also be useful.

  • Hello, I suppose the link you shared is only for Views 3.x branch and same goes for Apache Solr as well. Quoted in the Website as "Note to all: we’re using views 3.x-dev, apachesolr 3.x-dev, and apachesolr_views 3.x-dev." Please have a good look at my requirements. thanks. – Aneek Mukhopadhyay Sep 6 '13 at 17:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.