lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "prabin meitei" <>
Subject excluding a list of items while querying
Date Thu, 16 Oct 2008 18:51:13 GMT
Hi,     I have a large index of documents of fields "id" "name" and few
while querying i do want to exclude a list of ids i passed in.

for this what i use is
Query query = new BooleanQuery();

 for (int i=0; i<list.size(); i++){

                term = new Term("id", list.get(i).toString());

                termQuery = new TermQuery(term);

                query.add(termQuery, Occur.MUST_NOT);


the problem with this is that when my list size grows larger (more than
1024) it gives tooManyBooleanCauses exception.

i tried by changing the query to

query.add(new QueryParser("id", new StandardAnalyzer()).parse(list.toString()),

this also gives the same problem when list size is big.

I do not want to increase the max clause limit ('coz of performance issues)

Is there any simple solution to such problem?

In similar situation I want to get only the list of ids i passed in. i want
to use lucene only for scoring

Any suggestion will be greatly appreciated.


  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message