首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >ElasticSearch和Porterstem

ElasticSearch和Porterstem
EN

Stack Overflow用户
提问于 2011-03-22 00:26:22
回答 1查看 4K关注 0票数 3

我正在考虑使用Elasticsearch来提供我们网站的搜索功能。

我一直在试验它,但无法启用Porterstem (这样就可以搜索fight matches、fights和fighting)。

这是我的输入摘要。

代码语言:javascript
复制
    curl -XPUT localhost:9200/local/ -d'
    index :                     
        analysis : 
            analyzer : 
                stemming : 
                    type : custom 
                    tokenizer : standard 
                    filter : [standard, lowercase, stop, porterStem] 
    '

    curl -XPUT localhost:9200/local/_mapping -d'{"properties": { "title" : { "analyzer" : "stemming", "type" : "string" }}}'

    curl -XPUT localhost:9200/local/article/1 -d'{"title": "Fight for your life"}'
    curl -XPUT localhost:9200/local/article/2 -d'{"title": "Fighting for your life"}'
    curl -XPUT localhost:9200/local/article/3 -d'{"title": "My dad fought a dog"}'
    curl -XPUT localhost:9200/local/article/4 -d'{"title": "Bruno fights Tyson tomorrow"}'

然而,运行“战斗”搜索只匹配第一个条目-包含确切术语的条目。

代码语言:javascript
复制
curl -XGET localhost:9200/local/_search?q=fight

正确的设置似乎已设置,但似乎不起作用。

代码语言:javascript
复制
      "indices" : {
        "local" : {
          "aliases" : [ ],
          "settings" : {
            "index.analysis.analyzer.stemming.type" : "custom",
            "index.analysis.analyzer.stemming.tokenizer" : "standard",
            "index.analysis.analyzer.stemming.filter.1" : "lowercase",
            "index.analysis.analyzer.stemming.filter.0" : "standard",
            "index.analysis.analyzer.stemming.filter.3" : "porterStem",
            "index.analysis.analyzer.stemming.filter.2" : "stop",
            "index.number_of_shards" : "5",
            "index.number_of_replicas" : "1"
          },

有没有人启动并运行了这个功能,并且能够给我指出正确的方向?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2011-03-22 19:18:24

这里有一个使用自定义分析器的示例配置,使用snowball词干分析器:Why ElasticSearch is not finding my term

票数 4
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/5380540

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档