[hibernate-dev] [Search] Why is global @AnalyzerDefs scanning limited to @Entity?

Sanne Grinovero sanne at hibernate.org
Thu Jun 20 12:39:46 EDT 2013

Hi Guillame,
reusing a @MappedSuperClass annotated entity sounds like a workaround
rather than the proper solution.

But I see your point on defining the global analyzers in a centralized
place rather than have them scattered on entities; question is if we
can do better?

There is a property to define the default analyzer:
_hibernate.search.analyzer_ . Maybe we could introduce a property to
point to a class containing all analyzers?

hibernate.search.global_analyzers = com.example.analisys.GlobalSearchAnalyzers

(I'm not liking my own idea about a property, just writing down some
ideas to the get the brainstorming started)

Ideally I'd even like to deprecate defining global analyzers on
@Indexed entities: they really should be used only in the scope of the
entity itself, and I would like to propose this change for 5.0 but
indeed we would first need to clarify where the global annotations
should be defined.

Hardy, while moving to Jandex would it be possible - and efficient -
for us to just find all @AnalyzerDefs on the user classpath (without
these necessarily needing to be mapped entities) ?


On 20 June 2013 17:22, Guillaume Smet <guillaume.smet at gmail.com> wrote:
> Hi,
> We would like to declare our global @AnalyzerDefs on a class which
> isn't a specific entity.
> For the @TypeDefs of Hibernate, we do it by declaring the @TypeDefs on
> a class annotated with @MappedSuperClass but with @AnalyzerDefs, we
> are forced to declare them on a concrete @Entity.
> Is this an oversight or something due to the way the initialization of
> Hibernate Search is done and we cannot change?
> I know it's only cosmetic but it's a bit ugly to have a dummy entity
> and a dummy table in our core framework just to be able to declare
> global @AnalyzerDefs.
> Thanks for your feedback.
> --
> Guillaume
> _______________________________________________
> hibernate-dev mailing list
> hibernate-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/hibernate-dev

More information about the hibernate-dev mailing list