Lucene rewrites RangeQueries into a BooleanQuery containing a bunch of
OR'd terms. If you have too many terms (dates in your case), you will
run into a TooManyClauses exception. I think the default is about
1024; you can set it with BooleanQuery.setMaxClauseCount().
On 5/31/05, Kevin Burton <[EMAIL PROTECTED]> wrote:
> Andrew Boyd wrote:
>
> >How about using range query?
> >
> >private Term begin, end;
> >
> >begin = new Term("dateField",
> >DateTools.dateToString(Date.valueOf(<"backInTimeStringDate">)));
> >end = new Term("dateField",
> >DateTools.dateToString(Date.valueOf(<"farFutureStringDate">)));
> >
> >RangeQuery query = new RangeQuery(begin, end, true);
> >
> >IndexSearcher searcher = new IndexSearcher(directory);
> >
> >Hits hits = searcher.search(query);
> >
> >Document minDoc = hits.doc(0);
> >Document maxDoc = hits.doc(hits.length()-1);
> >
> >String minDateString = minDoc.get("dateField");
> >String maxDateString = maxDoc.get("dateField");
> >
> >
> >
> This certainly is an interesting solution. How would lucene score this
> result set? The first and last will depend on the score...
>
> I guess I can build up a quick test........
>
> Kevin
>
> --
>
>
> Use Rojo (RSS/Atom aggregator)! - visit http://rojo.com.
> See irc.freenode.net #rojo if you want to chat.
>
> Rojo is Hiring! - http://www.rojonetworks.com/JobsAtRojo.html
>
> Kevin A. Burton, Location - San Francisco, CA
> AIM/YIM - sfburtonator, Web - http://peerfear.org/
> GPG fingerprint: 5FB2 F3E2 760E 70A8 6174 D393 E84D 8D04 99F1 4412
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]