Just for the record, the solution that I adopted is as follows: - Create a setType(String field, String type) and call it for any known numeric fields, before adding any document. This method saves the type definition in a file and also sets the Map<String,NumericConfig> that is used in the method StandardQueryParser.setNumericConfigMap().
This method has the drawback that the types must be known in advance (that is, it is a schema), but it's more robust the guessing the types from the documents itself (as my initial request implied). Kind regards, Rolf. On Fri, Feb 1, 2013 at 3:22 PM, Rolf Veen <rolf.v...@gmail.com> wrote: > On Fri, Feb 1, 2013 at 12:43 PM, Michael McCandless > <luc...@mikemccandless.com> wrote: > >> There is actually one way to check if a field was indexed numerically: >> you can seek to the first term in the field, and attempt to parse it >> as a long/float/etc., and if that throws a NumberFormatException, it >> was indexed numerically. >> >> Ie, numeric fields are indexed using the formats from >> oal.util.NumericUtils, which will not parse as "normal" numbers. >> >> This is what Lucene's FieldCache does to check how to decode numeric >> values when uninverting ... > > Very good info. > Thank you, Mike. --------------------------------------------------------------------- To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org For additional commands, e-mail: java-user-h...@lucene.apache.org