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

Andrej Golovnin golovnin at gmx.net
Mon May 7 17:47:09 EDT 2012

Hi all,

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.

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'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.

To improve the performance and to reduce memory consumption I would
like to change the default value of Field#norms() from YES to NO because
it has impact on the performance and memory consumption.
And users of Hibernate Search should decide per field if they really need
norms or not, e.g. if they want to do advanced queries, then they can activate
the norms for such fields.

I know this would break backwards compatibility. But I think in this case it
is a good thing.

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.

What do you think?

Best regards,
Andrej Golovnin

More information about the hibernate-dev mailing list