vipin k.
vipin k.

Reputation: 2715

SOLR Query similarto NOT IN (LIST)

I have a requirement where we need to fetch the values like

CustomerID NOT IN (LIST OF IDs Indexed) from SOLR Index.

Can anyone suggest how can we achieve this using solr query?.

Upvotes: 2

Views: 2547

Answers (2)

Hugo Zaragoza
Hugo Zaragoza

Reputation: 592

CustomerID:* AND NOT CustomerID:(ID1 OR ID2 OR ... IDn)

Upvotes: 0

Vinod
Vinod

Reputation: 1953

Use Filter query fq=-id:("id1", id:"id2") example

http://localhost:8983/solr/collection/select?indent=on&q=querystring&wt=json&fq=-id:("id1", id:"id2")

Here it discards documents with list of IDs mentioned in filter query(fq) parameter

Upvotes: 5

Related Questions