lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From EquilibriumCST <>
Subject Nested query in SOLR filter query (fq)
Date Mon, 15 Jul 2013 11:19:12 GMT
Hi all,

I have the following case.

Solr documents has fields --> id and status. Id is not unique. Unique is the
combination of these two elements.
Documents with same id have different statuses.

List of Documents
  id1        1
  id1        2
  id1        3
  id1        4
  id2        1
  id2        2
  id3        1
I need to make query that takes all documents with specific status and to
exclude documents that don't have other specific status. 
As an example I need to get all documents with status 2 and don't have
status 3. 
The expected result should be document :
     id2    2
Another example: all documents with status 1 and don't have status 3. Then
the result should be: 
     id2        1
     id3        1
Here is my query that don't work,status&fq=-id:(*:*%20AND%20status:2)
The problem is in filter query(fq) part. In fq must be the ids of the
documents with status 2 and if the current document id is in this list to be
I guess some subquery must be used in fq part or something else. 
Just for information we are using APACHE SOLR 3.6 and document count is
around 100k.

Thanks in advance!

View this message in context:
Sent from the Solr - User mailing list archive at

View raw message