lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "RamPrasad Suswaram" <smart...@india.com>
Subject Re: ParseException: Too many boolean clauses
Date Wed, 03 May 2006 11:17:52 GMT
Hi,

The code needs a minor change. Replace 

queryParser = new QueryParser("searchData",new StandardAnalyzer());

with 

queryParser = new QueryParser("desc",new StandardAnalyzer());

regards,
Ram Prasad.

> ----- Original Message -----
> From: "RamPrasad Suswaram" <smart_rp@india.com>
> To: java-user@lucene.apache.org
> Subject: ParseException: Too many boolean clauses
> Date: Wed, 03 May 2006 18:10:26 +0800
> 
> 
> Hi,
> 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(
>                  		"searchData",
>                          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);
> 
>    return idxSearcher.search(booleanQuery);
> }
> 
> 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.
> 
> Regards,
> Ram Prasad
> 
> --
> India.com free e-mail - www.india.com.
> 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: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org

>


-- 
India.com free e-mail - www.india.com. 
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: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Mime
View raw message