lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "RamPrasad Suswaram" <>
Subject ParseException: Too many boolean clauses
Date Wed, 03 May 2006 10:10:26 GMT
I am new to Lucene & am using Lucene 1.9.1. Frequently I get a ParseException due to "Too
many boolean clauses".

The lucene documents that I have created have three fields "userID", "desc" and "codes". I
need to find the information pertaing a set of users whose description contains a given search
text and also relates to a set of codes (each user has multiple codes associated with him/her).
 The code (programming code) I have is as below:

private Hits performSearch(String userIds, String srchText, String codes) {
  QueryParser queryParser;
  Query userInNtwkQuery = null;
  Query codeQuery = null;
  Query keywordQuery = null;
  BooleanQuery booleanQuery = new BooleanQuery();

  queryParser = new QueryParser("userID",
                        new StandardAnalyzer());
  userInNtwkQuery = queryParser.parse(userIds);
  booleanQuery.add(userInNtwkQuery, BooleanClause.Occur.MUST);

  queryParser = new QueryParser(
                        new StandardAnalyzer());
  keywordQuery = queryParser.parse(srchText);
  booleanQuery.add(keywordQuery, BooleanClause.Occur.MUST);

  queryParser = new QueryParser("codes",
                        new StandardAnalyzer());
  codeQuery = queryParser.parse(codes);
  booleanQuery.add(codeQuery, BooleanClause.Occur.MUST);


The first argument of the "performSearch" method 'userIDs' is a String value containing user-ids
delimited by space (for e.g. "1 4 7 1100 99 887") and there is a possibility of the number
of user-ids being as high as 15000.  The second argument 'srchText' can be any free text up
to a max of 10 words and the third argument 'codes' is a String value containing codes delimited
by space (for e.g. "00544 11744 11743"), the number of codes could as high as 1500 to 2000
codes for a single search.

As the number userIDs and/or codes per search is exceeding the lucene default limit of 1024
boolean clauses I am facing the problem of 'Too many boolean clauses'.  Is it advisable to
solve this problem by using "BooleanQuery.setMaxClauseCount(Integer.MAX_VALUE)" approach or
is a better alternative (work around) available.  Please advice. 

Ram Prasad

-- free e-mail - 
Check out our value-added Premium features, such as an extra 20MB for mail storage, POP3,
e-mail forwarding, and ads-free mailboxes!

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message