documents that contain value(s) other than the ones specified in the solr query

Viewed 44

I am working on a solr query that aims to retrieve documents that have other than specific values in array.

Example

{
  id:1,
  field:["a", "b", "c"]
},
{
  id:2,
  field:["a", "b"]
}
  • If i want to have documents which contains other than values "a" and "b", I expect to have this result from solr
{
  id:1,
  field:["a", "b", "c"]
}
  • If i want to have documents which contains other than values "a" and "b" and "c", I expect to have no result from solr

I tried to solve my problem with this query. I can get the right result for my first if but for the second, solr still sends me the document with id 1 even though it has no other value than "a", "b" and "c" in the field array.

# work
field: * AND (*:* NOT field:("a" OR "b"))

# doesn't work
field: * AND (*:* NOT field:("a" OR "b" OR "c"))

Does anyone have a solution to make this type of query with solr? :(

0 Answers
Related