Hi Marcelo,
I am not sure why Grails people don't use annotations. It looks to me much better than the arbitrary static methods dynamic languages use.
Also I could not find where the Compass API to create a mapping are. The link you sent me shows how to programmatically configure it but we already have that.
Anyway, to test my Fluent designer skills and to avoid being nagged by people asking for XML support I have stated a programmatic mapping API for Hibernate Search this week end.
Code:
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).
Let me know what you think. Either I will complete the work or even better you can do it if you are interested in pursuing my initial investigation. I have removed all the difficulties but one and I know how to solve it.
It's available upstream and requires the upstream commons-annotations and annotations projects.