p.matsinopoulos
p.matsinopoulos

Reputation: 7810

Why Sunspot Solr does not bring results when I include "of" word in search query?

I am trying to make a simple query using sunspot/solr and I seem to fail to fetch the results when my query string contains the word "of".

To be more specific:

When I query "University of Thessaloniki" solr returns no hits, but when I query "University Thessaloniki" it does.

Here are the logs:

Sep 29, 2012 10:24:56 AM org.apache.solr.core.SolrCore execute
INFO: [] webapp=/solr path=/select params={fl=*+score&start=0&q=University+of+Thessaloniki&qf=status_code_text+pi_details_text+other_party_name_text+contact_details_text+other_pi_details_text+sending_or_receiving_text+start_at_str_text+materials_text&wt=ruby&fq=type:Mta&defType=dismax&rows=10000} hits=0 status=0 QTime=8 

Sep 29, 2012 10:25:09 AM org.apache.solr.core.SolrCore execute
INFO: [] webapp=/solr path=/select params={fl=*+score&start=0&q=University+Thessaloniki&qf=status_code_text+pi_details_text+other_party_name_text+contact_details_text+other_pi_details_text+sending_or_receiving_text+start_at_str_text+materials_text&wt=ruby&fq=type:Mta&defType=dismax&rows=10000} hits=9 status=0 QTime=5 

When I make the same query directly on the admin interface of sunspot/solr (http://localhost:8981/solr/admin/analysis.jsp?highlight=on) it highlights matches.

Can you please help me, find my mistake?

Thanks in advance Panayotis

Upvotes: 0

Views: 481

Answers (1)

javanna
javanna

Reputation: 60245

You're using the dismax query parser, which allows you to configure the minimum number should match. The default value is 100%, meaning that all the clauses must match. Apparently your documents don't contain the word of. If that's the case you just need to configure the minimum should match parameter, taking into account that its behaviour slightly changes depending on the solr version you're using. On the other hand, if you think you have the word of I'd suggest you to check how you are indexing your documents. Is it possible that you're applying a stopword filter at index time but not at query time?

Upvotes: 1

Related Questions