为了改善词干,我们希望从默认的分析器切换到雪球,但是,在正确的设置中遇到很多困难并且会感激任何帮助。在
环境: - Sun的Java 1.6.16 - Grails 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
}
答案 0 :(得分:0)
您是否尝试过将这些设置放入Searchable.groovy而不是Config.grovy?
在Searchable.groovy,我有:
compassSettings = [
'compass.engine.analyzer.default.type': 'snowball',
'compass.engine.analyzer.default.name': 'English',
'compass.engine.analyzer.search.type': 'snowball',
'compass.engine.analyzer.search.name': 'English',
]
这似乎对我很好。