[hibernate-dev] [HSEARCH] Proposal to change the default value of Field#norms()

Hardy Ferentschik hardy at hibernate.org
Tue May 8 04:20:42 EDT 2012


On May 7, 2012, at 11:47 PM, Andrej Golovnin wrote:

> the default value of norms() in the Field annotation is defined to YES. 
> I doubt it is always needed, e.g. if you have an Enum field, do you really
> need norms for it? The same applies to long/int, boolean, date, OID fields
> and very short fields like a code of the country.

It depends. Maybe you want to boost any of these fields ad index time.

> I have already asked Sanne on the chat what was the motivation
> to set it per default to YES. And he responded that the main reason is
> backwards compatibility, i.e. it has always been enabled.

I don't think backwards compatibility is the only reason. IMO it is a sensible 
default. Changing it to Norms.NO per default means that @Boost won't work
out of the box anymore. Also looking at org.apache.lucene.document.Field the options
which omit the norm are marked "for expert use".
If you have no needs for index time boosting and need the additional memory you can
gain by not storing norms, you need to explicitly disable the storing of norms.

> I'm now analyzing our program and I see absolutely no need for norms
> (we are in process to switch from Hibernate Search 3.0.1 to the latest one).
> But changing it for every field is a really huge task as we have a big application.

If you already have the @Field annotations in the code, is it not just a simple search&replace.
Either via IDE or simple see script?

> Sanne also suggested an alternative solution. We may introduce a new global
> option which would define the default value for Field#norms(). The default
> value of this option would be obviously YES. Users like me could change it
> to NO if needed. I personally think we have already enough options. But
> this solution would be OK for me.

-1 I agree that we already have enough options and the proposed changed will
just introduce ambiguities. 

--Hardy




More information about the hibernate-dev mailing list