Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Multiple word queries on solr

Tags:

solr

  • I am using solr 3.3.0 working out of the box using the example folder
  • solrQueryParser defaultOperator = "OR"

My problem is that Solr doesn't seem to be returning good results when I search for a multiple word phrase.

The following search return no results.

  1. http://localhost:8080/solr/select/?q=roof+fixing

However, when I search for roof or fixing, they both return a few good results.

  1. http://localhost:8080/solr/select/?q=roof returns 4 results
  2. http://localhost:8080/solr/select/?q=fixing returns 3 results

On the query for "roof fixing", I expect solr to return 7 results. The 4 records for roof and 3 records for fixing.

Is any special configuration necessary for that to happen?

like image 868
filype Avatar asked Feb 27 '12 03:02

filype


1 Answers

Solr won't necessarily return 7 results for "roof OR fixing" as one result could include both "roof" and "fixing". Suppose "roof" has 3 results, "fixing" has 4, but both "roof" and "fixing" appear in 2 results. You will get only 5 results on a search for "roof OR fixing" as Solr will not return duplicate results.

Have you tried using a url-encoded space ("%20") instead of the "+" sign? If the default operator is OR you should not need to include that operator.

like image 131
David Faber Avatar answered Sep 21 '22 19:09

David Faber