lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jayakumar.V" <jayakuma...@uaeexchange.com>
Subject Boolean Query - TooManyClauses Exception
Date Thu, 19 May 2005 12:39:58 GMT
Hi,

I'm getting a TooManyClauses Exception when I try to query for a particular
date range. 

I've around 4 million documents with 21 fields each. 

The fields to search into are determined by the user - it can be field F1 or
F2 or both. 

Also there is a date range within which the results need to be restricted.

The date is indexed as a KEYWORD & the fields F1 & F2 are indexed as TEXT.

 

Following is the code I've used :

 

Term from = new Term("txnDate", format.format(dateFrom));      --> format
gives the date in yyymmdd format

Term to = new Term("txnDate", format.format(dateTo));

 

Query rangeQuery = new RangeQuery(from,to,true);

 

BooleanQuery mainQuery = new BooleanQuery();

 

// searchIn is an string array containing the fields to look into

for (int i=0; i<searchIn.length; i++) {                                

          TermQuery query = new TermQuery(new
Term(searchIn[i],searchString));

          mainQuery.add(query,false,false);

}

 

Filter queryFilter = new QueryFilter(mainQuery);

 

Sort sort = new Sort("txnDate",true);

Hits hits = searcher.search(rangeQuery,queryFilter,sort);

 

I'm not sure of the way I've constructed the Query. I had used the
BooleanQuery to enable searching in multiple fields.

I'm able to get results to a max. date range of 2 years beyond which it
throws the subject exception.

Any better way to construct the query? 

 

tia

Jayakumar.V


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