2016-09-15 6 views
2

私は、特定の特定の検索用語に対処できるようにしたい。したがって、ユーザーが「課税」を検索した場合、税金の結果を含めることができるようにするには、タイトルフィールドにのみ表示します。以下は私のElasticsearch設定です。私はバージョン1.5を使用しています。超特異的用語を扱う弾性探索

設定

{ 


"content_pages":{ 
     "settings":{ 
     "index":{ 
      "creation_date":"1473848573964", 
      "analysis":{ 
       "analyzer":{ 
        "string_analyzer":{ 
        "filter":[ 
         "standard", 
         "lowercase", 
         "stop", 
         "asciifolding" 
        ], 
        "char_filter":[ 
         "html_strip" 
        ], 
        "type":"custom", 
        "tokenizer":"standard" 
        } 
       } 
      }, 
      "number_of_shards":"2", 
      "number_of_replicas":"0", 

     } 
     } 
    } 
} 

マッピング

{ 
    "from":0, 
    "size":"10",  
    "query":{ 
     "bool":{ 
     "must":[ 
      { 
       "multi_match":{ 
        "query":"taxation", 
        "fields":[ 
        "body:value^13.0", 
        "content_page_tab_data^13.0", 
        "field_body:value^13.0", 
        "field_tabs_page_body:value^13.0", 
        "title^21.0" 
        ] 
       } 
      } 
     ], 
     "should":[ 
      { 
       "query_string":{ 
        "query":"(taxation)", 
        "fields":[ 
        "body:value^13.0", 
        "content_page_tab_data^13.0", 
        "field_body:value^13.0", 
        "field_tabs_page_body:value^13.0", 
        "title^21.0" 
        ] 
       } 
      }, 
      { 
       "fuzzy_like_this" : { 
        "fields" : ["title"], 
        "like_text" : "taxation", 
        "fuzziness": "AUTO" 
       } 
      } 
     ] 
     } 
    }  
} 

クエリ上記の検索クエリは返しません

"mappings":{ 
    "content_page_type":{ 
     "_all":{ 
      "auto_boost":true 
     }, 
     "properties":{ 
      "author":{ 
       "type":"integer" 
      }, 
      "body:value":{ 
       "type":"string", 
       "boost":13.0, 
       "analyzer":"string_analyzer" 
      }, 
      "changed":{ 
       "type":"date", 
       "format":"date_time" 
      }, 
      "component":{ 
       "type":"string", 
       "index":"not_analyzed", 
       "analyzer":"string_analyzer" 
      }, 
      "content_page_tab_data":{ 
       "type":"string", 
       "boost":13.0, 
       "analyzer":"string_analyzer" 
      }, 
      "created":{ 
       "type":"date", 
       "format":"date_time" 
      }, 
      "field_aat_resource_type_taxonomy":{ 
       "type":"integer" 
      }, 
      "field_asset_file:file":{ 
       "type":"integer" 
      }, 
      "field_body:value":{ 
       "type":"string", 
       "boost":13.0, 
       "analyzer":"string_analyzer" 
      }, 
      "field_file_private:file":{ 
       "type":"integer" 
      }, 
      "field_study_resource_file:file":{ 
       "type":"integer" 
      }, 
      "field_tabs_page_body:value":{ 
       "type":"string", 
       "boost":13.0, 
       "analyzer":"string_analyzer" 
      }, 
      "id":{ 
       "type":"integer", 
       "include_in_all":false 
      }, 
      "level":{ 
       "type":"string", 
       "index":"not_analyzed", 
       "analyzer":"string_analyzer" 
      }, 
      "nid":{ 
       "type":"integer" 
      }, 
      "programme":{ 
       "type":"string", 
       "index":"not_analyzed", 
       "analyzer":"string_analyzer" 
      }, 
      "search_api_access_node":{ 
       "type":"string", 
       "index":"not_analyzed", 
       "analyzer":"string_analyzer" 
      }, 
      "search_api_language":{ 
       "type":"string", 
       "index":"not_analyzed", 
       "analyzer":"string_analyzer" 
      }, 
      "status":{ 
       "type":"boolean" 
      }, 
      "strand":{ 
       "type":"string", 
       "index":"not_analyzed", 
       "analyzer":"string_analyzer" 
      }, 
      "title":{ 
       "type":"string", 
       "boost":21.0, 
       "analyzer":"string_analyzer" 
      }, 
      "type":{ 
       "type":"string", 
       "index":"not_analyzed", 
       "analyzer":"string_analyzer" 
      } 
     } 
    } 
    } 

タイトルに「税」が含まれていても「課税」のみが含まれている結果。私はまた、「関係」や「行動」などの無関係の結果を含めることも望まない。

答えて

0

私はAlgorithmic Stemmerを使用してこれを解決することができました。私はあいまい検索で回り込んでいたが、それは望ましい結果を達成するための最良の方法ではなかった。

関連する問題