I have started working on that in the plane back home.
It's available upstream and requires the upstream commons-annotations and annotations projects.

      SearchMapping mapping = new SearchMapping();
      mapping.analyzerDef( "stem", StandardTokenizerFactory.class )
               .tokenizerParam( "name", "value" )
               .tokenizerParam(  "name2", "value2" )
               .filter( LowerCaseFilterFactory.class )
               .filter( SnowballPorterFilterFactory.class)
                  .param("language", "English")
            .analyzerDef( "ngram", StandardTokenizerFactory.class )
               .tokenizerParam( "name", "value" )
               .tokenizerParam(  "name2", "value2" )
               .filter( LowerCaseFilterFactory.class )
               .filter( NGramFilterFactory.class)
                  .param("minGramSize", "3")
                  .param("maxGramSize", "3")
            .indexedClass(Address.class, "Address_Index")
               .property("street1", ElementType.FIELD)
                  .field()
                  .field()
                     .name("street1_iso")
                     .store( Store.YES )
                     .index( Index.TOKENIZED )
                     .analyzer( ISOLatin1Analyzer.class)
                  .field()
                     .name("street1_ngram")
                     .analyzer("ngram")
            .indexedClass(User.class)
               .property("name", ElementType.METHOD)
                  .field()
            .analyzerDef( "minimal", StandardTokenizerFactory.class  );

configuration.getProperties().put( "hibernate.search.mapping_model", mapping );

It works nicely (analyzerDef is not wired yet) and the mapping API needs to be completed. A benefit is that it solves the problem encountered by people willing to get XML mapping support in a much nicer way.

It would benefit from a few additional pairs of eye before completing the work.

http://forum.hibernate.org/viewtopic.php?p=2409404#2409404
http://opensource.atlassian.com/projects/hibernate/browse/HSEARCH-352
_______________________________________________
hibernate-dev mailing list
hibernate-dev@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/hibernate-dev

Reply via email to