I run Solr query with 3 parameters and I want results to be sorted by relevancy to one of parameters (not by relevancy to parameters’ combination).
Example:
SolrQuery solrQuery = new SolrQuery();
solrQuery.add("title", "some title");
solrQuery.add("date", "some date");
solrQuery.add("description", "some description");
solrQuery.addSortField("score", SolrQuery.ORDER.desc);
Results of query will be sorted by relevancy to combination of title+date+description, but I need to score ONLY by title.
How could I do it?
P.S. I use Solr 4.0 BETA
Since you’re only scoring relevancy by one field, then you can limit your searches to that one field in ‘qf’, query fields.
Edit or add to an existing requestHandler in solrconfig.xml
You can also specify specific boosts in the ‘qf’ parameter, but in the single query-field case, the boost won’t do anything, because boosts are only relevant in the context of other fields.
Here’s an example that searches through multiple fields, and then scores results found in ‘title’ the highest.