lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Hostetter <hossman_luc...@fucit.org>
Subject Re: Boolean Query - TooManyClauses Exception
Date Fri, 20 May 2005 22:18:23 GMT

: Any reason why Range query doesn't just iterate over the terms of the
: field instead of creating a large BooleanQuery with term queries?

Because Queries inherently have score.  The implimentation of RangeQuery
allows documents with many terms in the range to score higher then
documents with only a single term.

If you don't care about the scoring implications, you can use a
RangeFilter.



:
: Are there any specific difficultites in doing so or any other impacts?
:
: Thanks
:
: -John
:
: On 5/19/05, Jayakumar.V <jayakumar.v@uaeexchange.com> wrote:
: > 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
: >
: >
: >
:
: ---------------------------------------------------------------------
: To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
: For additional commands, e-mail: java-user-help@lucene.apache.org
:



-Hoss


---------------------------------------------------------------------
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