Last updated February 6, 2011. Created by pwolanin on February 6, 2011.
Log in to edit this page.
The Apaches Solr Search Integration module has lots of points for modifications via the API. Suggestions for customizing the Drupal module are listed below.
Some relevant blog posts:
Comments
Improving search results for phrases
Many times people search for phrases and one way to improve the result of such query is to use sloppy phrase query. If you are using Drupal 7 with apache solr you can alter the apache query. Following code will handle it just change MYMODULE to whatever module you are using.
function MYMODULE_apachesolr_query_alter($query) {
// improve search results for phrases
// where words appear closer to each other
$param = $query->getParam('pf');
if ( empty($param) ) {
$query->addParam('pf', 'label');
$query->addParam('pf', 'content');
$query->addParam('ps', 50);
}
}
Both label and content field will be used for phrase sloppy query.
You can read more about it on Solr Relevancy Faq or for a use case on the blog post
---
blog | twitter| Mimir Technologies Pvt. Ltd.