-->
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.  [ 1 post ] 
Author Message
 Post subject: ClassBridge analyzer not being applied to custom field name
PostPosted: Tue Apr 16, 2013 9:11 am 
Pro
Pro

Joined: Wed Nov 05, 2003 7:22 pm
Posts: 211
Hi,

I have a classbridge that creates a number of custom fields (not present in the class) that require a particular analyzer to be applied to them.
However, it seems that the correct analyzer is not being applied. Stepping through the code, I see that Classbridge analyzers are being added as scoped analyzers applied to an empty field name.
I'm wondering if this is why my analyzer is not being applied. In Luke I see what looks like a standardAnalyzer like result. Any ideas why?

BTW, manually creating the analyzer withing the fieldbridge and applying it as a tokenstream resolves the issue, so it would seem like a bug.

Code:
@Entity
@Table
@AnalyzerDefs({
   @AnalyzerDef(name = "autocompleteAnalyzer", tokenizer = @TokenizerDef(factory = StandardTokenizerFactory.class), filters = {
      @TokenFilterDef(factory = LowerCaseFilterFactory.class),
      @TokenFilterDef(factory = StopFilterFactory.class, params = {
         @Parameter(name="words", value= "nl/project/dao/hibernate/search/stopwords/stopwords-combined.txt" ),
         @Parameter(name="ignoreCase", value="true")
       }),
      @TokenFilterDef(factory = ASCIIFoldingFilterFactory.class),
      @TokenFilterDef(factory = EdgeNGramFilterFactory.class, params = {
         @org.hibernate.search.annotations.Parameter(name = "minGramSize", value = "2"),
         @org.hibernate.search.annotations.Parameter(name = "maxGramSize", value = "15")
      })
   }),
   @AnalyzerDef(name = "mlAnalyzer", tokenizer = @TokenizerDef(factory = StandardTokenizerFactory.class), filters = {
      @TokenFilterDef(factory = StandardFilterFactory.class),
      @TokenFilterDef(factory = ASCIIFoldingFilterFactory.class),
      @TokenFilterDef(factory = LowerCaseFilterFactory.class)
   })
})
@ClassBridges({
   @ClassBridge(
      impl=MultiLingualClassBridge.class,
      store=Store.YES,
      params={
         @Parameter(name="field",value="tag"),
         @Parameter(name="useAnalyzer",value="true")
      }
   ),
   @ClassBridge(
      impl=MultiLingualClassBridge.class,
      store=Store.NO,
      analyzer=@Analyzer(definition="autocompleteAnalyzer"),
      params=@Parameter(name="field",value="tag_kw")
   )
})
@Indexed
public class Tag implements Serializable{
[...]

public class MultiLingualClassBridge implements FieldBridge,ParameterizedBridge {

   @Override
   public void set(
         String name,
         Object value,
         Document document,
         LuceneOptions luceneOptions) {

         field = new Field("myCustom_en", myValue,luceneOptions.getStore(), Index.ANALYZED);


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

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.