搜索包含单词分隔符,未找到引号内的停止词

rt4zxlrg  于 2021-07-13  发布在  ElasticSearch
关注(0)|答案(0)|浏览(212)

我遇到了一个elasticsearch问题:当搜索包含单词分隔符和引号内的停止词“\”的短语时,在搜索中找不到它。只找到带有停止词或分隔词的短语。
示例:“john\u doe in office”-未找到“john doe in office”-找到“john\u doe office”-找到
我们要找到“无名氏在办公室”。

//we use index analyzer:
"index_text_html": {
          "tokenizer": "whitespace",
          "char_filter": [
            "html_strip"
          ],
          "filter": [
            "index_text_html_word_delimiter_graph_filter",
            "lowercase",
            "remove_duplicates"
          ]
        }
      }

 "filter": {
        "index_text_html_word_delimiter_graph_filter": {
          "type": "word_delimiter_graph",
          "catenate_words": true,
          "catenate_numbers": true,
          "preserve_original": true
        }
//and search analyzer:
 "search_text": {
          "tokenizer": "whitespace",
          "filter": [
            "search_text_word_delimiter_graph_filter",
            "stop_words_filter",
            "lowercase",
            "remove_duplicates"
          ]
        }
    }

 "filter": {
        "index_text_html_word_delimiter_graph_filter": {
          "type": "word_delimiter_graph",
          "catenate_words": true,
          "catenate_numbers": true,
          "preserve_original": true
        },
         "search_text_word_delimiter_graph_filter": {
          "type": "word_delimiter_graph",
          "catenate_all": true,
          "generate_number_parts": false,
          "preserve_original": true
        },
        "stop_words_filter": {
          "type": "stop",
          "remove_trailing": false
        }
    }

有人有什么想法吗?

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题