0

I have implemented solr search o my site. When I search the query "Red Shoes", it is showing results for both Red and shoes. But I wants solr to show those records which contains both keywords "Red" and "Shoes". It it related to whitespace tokenizer ??. Thanks in advance.

Kamal Kishore
  • 325
  • 2
  • 4
  • 15

1 Answers1

0

You need to set the default operator. By default, it is OR, just like in the core Lucene standard query parser. You can set it to AND in your schema with:

<solrQueryParser defaultOperator="AND"/>

Or in your query string with q.op, like:

{!lucene q.op=AND df=text}red shoes
femtoRgon
  • 32,893
  • 7
  • 60
  • 87
  • 1
    Absolutely correct, but to be more specific, [LocalParams](http://wiki.apache.org/solr/LocalParams) are the way to go here. The version in schema.xml is being considered for deprecation (see [SchemaXml](http://wiki.apache.org/solr/SchemaXml#Default_query_parser_operator) for more information). – Dawngerpony May 09 '13 at 07:22