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.
- 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';
}
- 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 :(