-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: Multiple @AnalyzerDiscriminator in the same class
PostPosted: Mon Nov 28, 2011 12:20 pm 
Newbie

Joined: Mon Nov 28, 2011 8:21 am
Posts: 3
Hi,

I'm new to Hibernate Search. I have a multilanguage application and I've defined multiple Analyzers according to each specific language. I also defined a custom Discriminator to determine the analyzer that must be used for each field and language. The corresponding FieldBridges are also defined.

The problem I am facing with, is that I can not declare more than one @AnalyzerDiscriminator in the same class (a "org.hibernate.search.SearchException: Multiple AnalyzerDiscriminator defined in the same class hierarchy..." exception is raised).

Is there any way to do this? I don't want to declare a class level @AnalyzerDiscriminator, because I need to use diferent analyzers for other fields that are not language dependent.

Thanks in advance.


Top
 Profile  
 
 Post subject: Re: Multiple @AnalyzerDiscriminator in the same class
PostPosted: Wed Nov 30, 2011 6:08 am 
Hibernate Team
Hibernate Team

Joined: Thu Apr 05, 2007 5:52 am
Posts: 1689
Location: Sweden
Hi,

You can only have one discriminator. The best is probably to use the class level discriminator. When the discriminator is invoked you also get passed the field name and can act accordingly. Of course the coupling of the code becomes much tighter and changes in the entity might need changes in the discriminator as well.

--Hardy


Top
 Profile  
 
 Post subject: Re: Multiple @AnalyzerDiscriminator in the same class
PostPosted: Wed Nov 30, 2011 8:53 am 
Newbie

Joined: Mon Nov 28, 2011 8:21 am
Posts: 3
Hi Hardy,

Thank you very much for your answer. I had read about this possible solution, but hoped there was another way with less impact on future developments. I'll try this variant, perhaps externalizing the fields to discriminate by configuration, in a way to avoid modifications to the Discriminator in future interactions.

yramosm.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.