我想使用Programmatic API设置Hibernate Search(5.5.1.Final)。
使用注释我写
@AnalyzerDefs({
@AnalyzerDef(name = "el",
charFilters = {@CharFilterDef(factory = HTMLStripCharFilterFactory.class)},
tokenizer = @TokenizerDef(factory = StandardTokenizerFactory.class),
filters = {
@TokenFilterDef(factory = StandardFilterFactory.class),
@TokenFilterDef(factory = GreekLowerCaseFilterFactory.class),
@TokenFilterDef(factory = StopFilterFactory.class,
params = {@Parameter(name="words", value="stopwords-gr.txt")}),
@TokenFilterDef(factory = EdgeNGramFilterFactory.class,
params = {@Parameter(name="minGramSize", value = "3"),@Parameter(name="maxGramSize", value = "15"),@Parameter(name="side", value = "front")})
}
)
})
使用Programmatic API编写
SearchMapping mapping = new SearchMapping();
mapping.analyzerDef("el", StandardTokenizerFactory.class)
.filter(StandardFilterFactory.class)
.filter(GreekLowerCaseFilterFactory.class)
.filter(StopFilterFactory.class)
.filter(EdgeNGramFilterFactory.class)
.param("minGramSize", "3")
.param("maxGramSize", "15")
.param("side", "front");
但我无法弄清楚我将如何使用HTMLStripCharFilterFactory。
答案 0 :(得分:1)
简短的回答是,你做不到。当charFilters
选项作为HSEARCH-477的一部分引入时,错过了将其添加到程序化API中。所以功能还不存在。我创建了HSEARCH-2199作为功能请求来添加此功能。