Hareesh
Hareesh

Reputation: 113

How can I search exact List match in solr list field

For example, I've list field(solr.TextField) in my schema store list of values like follows

1) { fruits : ["Apple","Mango","orange"] }

2) { fruits : ["Mango","Apple"] }

I've keyword list for search is: ["Apple","Mango"]

What is the query that can get exact list match that contain only given all values "Apple","Mango".

Here it should give me second document.i.e., { fruits : ["Mango","Apple"] }

I've tried to using fruits : ( "Apple" "Mango" ), but it doesn't work, It giving me both documents.

Upvotes: 2

Views: 1212

Answers (1)

Oyeme
Oyeme

Reputation: 11225

Just use a simple boolean query (fruits:Mango AND fruits:Apple)

Updated:

(fruits:Mango AND fruits:Apple AND -fruits:orange)

Upvotes: 1

Related Questions