[hibernate-dev] Hibernate Search Metadata API: Numeric and other special Field types in Hibernate Search
Sanne Grinovero
sanne at hibernate.org
Mon Jul 15 13:39:46 EDT 2013
The new FieldSettingsDescriptor [1] has a couple of methods meant for
Numeric fields:
/**
* @return the numeric precision step in case this field is indexed as
a numeric value. If the field is not numeric
* {@code null} is returned.
*/
Integer precisionStep();
/**
* @return {@code true} if this field is indexed as numeric field,
{@code false} otherwise
*
* @see #precisionStep()
*/
boolean isNumeric();
Today we have specific support for the
org.apache.lucene.document.NumericField type from Lucene, so these are
reasonable (and needed to build queries) but this specific kind is
being replaced by a more general purpose encoding so that you don't
have "just" NumericField but can have a wide range of special fields.
So today for simplicity it would make sense to expose these methods
directly on the FieldSettingsDescriptor as it makes sense for our
users, but then also the #isNumeric() is needed as not all fields are
numeric: we're having these extra methods to accommodate for the needs
of some special cases.
Considering that we might get more "special cases" with Lucene4, and
that probably they will have different options, would we be able to
both decouple from these specific options and also expose the needed
precisionStep ?
I won't mention my favorite Vattern. I've considered adding subtypes
but not liking it as their usage would not be clear from the API.
Cheers,
Sanne
1 - as merged two minutes ago
More information about the hibernate-dev
mailing list