【发布时间】:2010-04-29 15:59:43
【问题描述】:
为了改进词干提取,我们希望从默认分析器切换到雪球,但是,在正确设置方面存在很多困难,希望能提供任何帮助。在
环境: - Sun 的 Java 1.6.16 - 圣杯 1.2.2 - 可搜索插件 0.5.5
Config.groovy: 两种设置都试过了:
compassSettings = ['compass.engine.analyzer.stemmed.type': 'snowball',
'compass.engine.analyzer.stemmed.name': 'English']
compassSettings = ['compass.engine.analyzer.snowball.type': 'snowball',
'compass.engine.analyzer.snowball.name': 'English',
'compass.engine.analyzer.search.type': 'snowball',
'compass.engine.analyzer.search.name': 'English']
Search.groovy - 调用:
def searchResult = searchableService.search(params.q, withHighlighter: {
highlighter, index, sr
if (!sr.highlights) {
sr.highlights = []
}
try {
sr.highlights[index] = highlighter.fragments("content")[0..2].join(" ")
} catch (IndexOutOfBoundsException ex) {
sr.highlights[index] = highlighter.fragment("content")
}
})
def suggestion = searchableService.suggestQuery(params.q)
if (suggestion != params.q) {
searchResult.suggestedQuery = suggestion
}
【问题讨论】:
标签: grails lucene searchable compass-lucene