【问题标题】:ElasticSearch and Porterstem analyserElasticSearch 和 Porterstem 分析器
【发布时间】:2011-07-19 19:52:42
【问题描述】:

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

我一直在试验它,但无法启用 Porterstem 分析器(以便搜索战斗匹配战斗和战斗)。

以下是我的输入内容。

    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"}'

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

curl -XGET localhost:9200/local/_search?q=fight

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

      "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"
          },

是否有人启动并运行了此功能并能够为我指明正确的方向?

【问题讨论】:

    标签: elasticsearch porter-stemmer


    【解决方案1】:

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

    【讨论】:

      猜你喜欢
      • 2014-02-25
      • 2016-05-07
      • 2014-02-15
      • 2012-10-01
      • 2018-07-21
      • 1970-01-01
      • 1970-01-01
      • 2023-03-25
      • 2015-02-11
      相关资源
      最近更新 更多