user1472672
user1472672

Reputation: 365

Subtle difference when searching multi value fields in Solr

I have a very simple question but I don't understand exactly why it happens and what the difference is.

Take a simple Solr search on a multi value field:

field_name:ABC AND DEF
field_name:(ABC AND DEF)

They return quite different results. I understand the brackets are for grouping but I don't understand the difference. It seems quite subtle.

Many thanks.

Upvotes: 0

Views: 22

Answers (1)

MatsLindh
MatsLindh

Reputation: 52892

The first query isn't doing what you think it's doing.

field_name:ABC AND DEF

This is parsed as:

field_name:ABC AND <default search field>:DEF

This is different from your second example, which is parsed as:

field_name:ABC AND field_name:DEF

In the first example the second part of your query is made against whatever field is defined as the default search field in your index (or in the query itself, if you've set df).

Upvotes: 1

Related Questions