2013-12-17 40 views
0

因此,我想關閉username,titletags字段中的停用詞過濾,但不要在description字段中關閉停用詞過濾。選擇性關閉彈性搜索中的停用詞

正如你可以想像我不想篩選出一個名爲the best結果,但我想從影響得分停止the如果是在description領域(搜索GitHub上the如果你想要一個例子)。

現在@Javanna說(Is there a way to "escape" ElasticSearch stop words?):

在你的情況我會禁用該特定領域的禁用詞,而不是修改的停止字,但如果你希望你可以做後者了。

做不到,所以我周圍中搜索,並試圖common查詢提供了一個例子:http://www.elasticsearch.org/blog/stop-stopping-stop-words-a-look-at-common-terms-query/這並沒有爲我工作的。

所以我搜索了專門停止過濾停止的話,但是我是來最接近的是停止它的索引寬:直接攻擊分析儀,或沒有該文件暗示使我自己的分析:/Can I customize Elastic Search to use my own Stop Word list?

什麼是最佳方式有選擇地禁用某些領域的停用詞?

回答

1

我想你已經知道該怎麼做了,這將是爲某些領域定製你的分析儀。根據我的理解,您無法爲此創建有效的語法示例。這是我們在項目中使用,我希望這個例子指出你在正確的方向:

{ 
    :settings => { 
     :analysis => { 
     :analyzer => { 
      :analyzer_umlauts => { 
      :tokenizer => "standard", 
      :char_filter => ["filter_umlaut_mapping"], 
      :filter  => ["standard", "lowercase"], 
      } 
     }, 
     :char_filter => { 
      :filter_umlaut_mapping => { 
      :type => 'mapping', 
      :mappings_path => es_config_file("char_mapping") 
      } 
     } 
     } 
    }, 
    :mappings => { 
     :company => { 
     :properties => { 
      [...] 
      :postal_city => { :type => "string", :analyzer => "analyzer_umlauts", :omit_norms => true, :omit_term_freq_and_positions => true, :include_in_all => false }, 
     } 
     } 
    } 
    } 
+0

甜它我明天將測試它,當我回來了,並將其標誌謝謝:) – Sammaye

+0

沒錯終於拿到了它工作感謝:) – Sammaye