Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SOLR query exclusions

I'm having an issue with querying an index where a common search term also happens to be part of a company name interspersed throughout most of the documents. How do I exclude the business name in results without effecting the ranking on a search that includes part of the business name?

example: Bobs Automotive Supply is the business name.

How can I include relevant results when someone searches automotive or supply without returning every document in the index?

I tried "-'Bobs Automotive Supply' +'search term'" but this seems to exclude any document with Bobs Automotive Supply and isn't very effective on searching 'supply' or 'automotive'

Thanks in advance.

like image 717
renhack Avatar asked Jul 15 '26 14:07

renhack


1 Answers

Second answer here, based on additional clarification from first answer.

A few options.

  1. Add the business name as StopWords in the StopWordFilter. This will stop Solr from Indexing them at all. Searches that use them will only really search for those words that aren't in the business name.

  2. Rely on the inherent scoring that Solr will apply due to Term frequency. It sounds like these terms will be in the index frequently. Queries for them will still return the documents, but if the user queries for other, less common terms, those will get a higher score.

  3. Apply a low query boost (not quite negative, but less than other documents) to documents that contain the business name. This is covered in the Solr Relevancy FAQ http://wiki.apache.org/solr/SolrRelevancyFAQ#How_do_I_give_a_negative_.28or_very_low.29_boost_to_documents_that_match_a_query.3F

like image 77
rfeak Avatar answered Jul 18 '26 11:07

rfeak