Nested query in SOLR filter query (fq) -


i have following case.

solr documents has fields --> id , status. id not unique. unique combination of these 2 elements. documents same id have different statuses.

list of documents

-id- -status-
id1         1
id1         2
id1         3
id1         4
id2         1
id2         2
id3         1

i need make query takes documents specific status , exclude documents don't have other specific status. example need documents status 2 , don't have status 3. expected result should document :

id2          2

another example: documents status 1 , don't have status 3. result should be:

id2         1
id3         1

here query don't work
(hostpart)/solr/select/?q=status:1&version=2.2&start=0&rows=10&indent=on&fl=id,status&fq=-id:(id:* , status:2)
problem in filter query(fq) part. in fq must ids of documents status 2 , if current document id in list excluded.
guess subquery must used in fq part or else.
just information using apache solr 3.6 , document count around 100k.

thanks in advance :)


Comments