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: Possible to find min and max values for a Date field?
Date Tue, 31 May 2005 05:29:36 GMT

: I guess I could use TermEnum to do a binary search until I get a hit but
: this seems a bit kludgy.

min is easy, it's the first term in the enum.

max ... well, the simplest way i can think of to find the max of a string
field is to use a StringIndex, something like...

  String[] s = FieldCache.getStringIndex().lookup;
  String max = s[s.length-1];

...but if you've got millions of field values, it may be more efficient to
do a binary search of the TermEnum.


-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