Any reason why Range query doesn't just iterate over the terms of the field instead of creating a large BooleanQuery with term queries?
Are there any specific difficultites in doing so or any other impacts? Thanks -John On 5/19/05, Jayakumar.V <[EMAIL PROTECTED]> 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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]