I am trying to implement a jobsearch in solr. What I want is to boost the title and keyword field. And also to negatively boost the those documents in which location is Anywhere.
For example : I searched for "Perl" and Location "Mumbai" The The result must contain all resumes with Perl in their title or keyword and location "Mumbai or Anywhere". But Resume with Anywhere field must come Last. I made the following query:
((((perl)) AND ( (perl) ttl:(perl)^5 kw:(perl)^2) )
AND (( pref:(Mumbai) (pref:Anywhere)^0.000000001)) )
But It is not giving proper result. Please suggest.
One way to fake a "negative boost" is to give a large boost to everything that does not match. You can do this something like this with you query (not tested , so experiment with this) :
Here is more about it:
http://wiki.apache.org/solr/SolrRelevancyFAQ#How_do_I_give_a_negative_.28or_very_low.29_boost_to_documents_that_match_a_query.3F