Hi guys,
I have a big issue with my code. I use the annotations to configure Hibernate search, according to the "Hibernate Search in Action" book, page 127. I thought everything was ok, but in facts, not.
Here is a simple example : I have the string "Terre, céramique et plâtre" to include in my index. Again, according to the book, I use a StandardTokenizerFactory, then a StandardFilter, then a LowercaseFilter, and then a StopFilter. Recently I added an AccentFilter (my own, and the way I discovered the thing).
According to those filters, I expected to have in my lucene index the following tokens : terre|ceramique|platre (Stop Filter is supposed to stop the "et"). What I get is far away : terre|céramique|et|plâtre
Ok, maybe there is a miss in my config? I tried to remove all the filters one by one and .... surprise ... nothing changed!
So, in my case, this code
Code:
@Entity
@Indexed
@AnalyzerDef(name = "categoriestokensanalyzer", tokenizer = @TokenizerDef(factory = StandardTokenizerFactory.class))
@Analyzer(definition = "categoriestokensanalyzer")
public class Commune implements Serializable {
generates the same output as this one
Code:
@Entity
@Indexed
@AnalyzerDef(name = "categoriestokensanalyzer", tokenizer = @TokenizerDef(factory = StandardTokenizerFactory.class), filters = {
@TokenFilterDef(factory = StandardFilterFactory.class),
@TokenFilterDef(factory = LowerCaseFilterFactory.class),
@TokenFilterDef(factory = AccentFilterFactory.class),
@TokenFilterDef(factory = StopFilterFactory.class, params = {
@Parameter(name = "words", value = "be/fgov/economie/artisans/services/stopwords.txt"),
@Parameter(name = "ignoreCase", value = "true") }) })
@Analyzer(definition = "categoriestokensanalyzer")
public class Categories implements Serializable
Some precisions on my environment : I run my code on tomcat 6, java 6. each time I redeploy, I physically destroy the old webapp, the lucene index (I use a re-index method) and tomcat's cache. An other thing to note is that in my custom filter I added a log4j trace and my filter is properly executed ... It just look like that all the filters are executed but none are really used...
I use hibernate 3.3.0.SP1, hibernate search 3.1.1.GA, lucene 3.0.2
I'm completely lost, so if anyone could help me ...