-->
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.  [ 4 posts ] 
Author Message
 Post subject: Getting access to the Analyzer defined for an Entity
PostPosted: Mon May 19, 2008 8:18 pm 
Beginner
Beginner

Joined: Wed Feb 25, 2004 6:23 pm
Posts: 39
Is it possible to get the custom composite Analyzer used by Hibernate Search for a particular entity? I have an entity that uses different analyzers for different fields, and I'm assuming that it creates some sort of composite Analyzer behind the scenes so that field names map to the field's actual analyzer. It would make my life a lot easier if I could get that composite analyzer for use on the query side.
Thanks in advance!


Top
 Profile  
 
 Post subject:
PostPosted: Tue May 20, 2008 2:55 am 
Hibernate Team
Hibernate Team

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

Even though Hibernate Search constructs a so called ScopedAnalyzer for each entity containing a hashmap of analyzers there is currently no way to get hold of this class and it also does not have a public API to access this map.

Have a look at Lucene's PerFieldAnalyzerWrapper. This class allows you to wrap multiple analyzers into a single class. You could implement your own instance of this class and set it on class level:

Code:
...
@Entity
@Indexed
@Analyzer(impl = foo.bar.MyPerFieldAnalyzerWrapper.class)
public class MyClass {
...


You could even define a global analyzer which handles even fields across multiple entities. I've used this approach multiple times and was quite happy with it.

--Hardy


Top
 Profile  
 
 Post subject:
PostPosted: Tue May 20, 2008 12:33 pm 
Beginner
Beginner

Joined: Wed Feb 25, 2004 6:23 pm
Posts: 39
That is what I suspected. Well, life would certainly be much easier if I could get that ScopedAnalyzer. Any hope of access to this being added to the API?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jun 03, 2008 4:58 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
I've added something slightly different in HSearch 3.1
I defined the notion of named analyzer and the API to access an analyzer by name.

_________________
Emmanuel


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 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.