Hi We have a date field which is indexed as NumericField<Long> and we'd like to get the first docid that is since 3 weeks ago. Currently we're doing something like this:
{code} Query q = NumericRangeQuery.newLongRange("date", timeBefore3Weeks, System.currentTimeMillis(), true, true); Scorer s = q.weight(searcher).scorer(reader, true, false); int doc = s.nextDoc(); if (doc == DISI.NO_MORE_DOCS) { // no docs since last 3 weeks } else { // do something } {code} Is there a more efficient way to achieve this? Can we use TermEnum to skip to the first term 'after 3 weeks'? If so, we can pull the first doc that appears in the TermDocs of that Term (if it's a valid term). I'm not sure though that we can use the lexicon with numeric fields this way ... Thanks Shai