Open msmolyak opened 12 years ago
Added this code to the plugin for specifying the default analyzer in the local mode.
In the config.groovy:
elasticSearch { ... /* * Default analyzer to use in local mode / defaultAnalyzer = "snowball" ...
In org.grails.plugins.elasticsearch.ClientNodeFactoryBean:
case 'local':
// Determines how the data is store (on disk, in memory, ...)
def storeType = elasticSearchContextHolder.config.index.store.type
if (storeType) {
nb.settings().put('index.store.type', storeType as String)
LOG.debug "Local ElasticSearch client with store type of ${storeType} configured."
} else {
LOG.debug "Local ElasticSearch client with default store type configured."
}
def queryParsers = elasticSearchContextHolder.config.index.queryparser
if (queryParsers) {
queryParsers.each { type, clz ->
nb.settings().put("index.queryparser.types.${type}".toString(), clz)
}
}
// New code starts here
if (elasticSearchContextHolder.config.defaultAnalyzer) {
nb.settings().put('index.analysis.analyzer.default.type', elasticSearchContextHolder.config.defaultAnalyzer)
LOG.debug "Setting default analyzer ${elasticSearchContextHolder.config.defaultAnalyzer}"
}
// New code ends here
nb.local(true)
break
Excuse me, if I want to use Chinese word how to add such Ansj this, also like defaultAnalyzer = "ansj" Thank you so do https://github.com/ansjsun/ansj_seg
How can I set the default analyzer for the entire index?