2016-05-10 2 views
1

word_delimiterは、単語でしか動作しないように設計されているようです。私は、以下のいずれかのようテキストのブロックを持っていた場合はどう:このインスタンスでword_delimiter on text

"Contra-indications of paracetamol can be of certain sorts" 

word_delimiterは、文全体を取り、私はcontra indicationsを検索することができるように、私は唯一の連結"Contra-indications"にそれを必要とするのに対し、それを連結し、contra-indicationsおよびcontraindicationsですが、テキストブロック内です。

答えて

1

あなたはこのような解析が必要です。

{ 
    "settings": { 
    "analysis": { 
     "filter": { 
     "delimiter_filter": { 
      "type": "word_delimiter", 
      "catenate_words": true, 
      "preserve_original": true 
     } 
     }, 
     "analyzer": { 
     "delimiter_analyzer": { 
      "type": "custom", 
      "tokenizer": "whitespace", 
      "filter": [ 
      "lowercase", 
      "delimiter_filter" 
      ] 
     } 
     } 
    } 
    }, 
    "mappings": { 
    "assets": { 
     "properties": { 
     "domain": { 
      "type": "string", 
      "analyzer": "delimiter_analyzer" 
     } 
     } 
    } 
    } 
} 

そして、あなたのサンプルテキストのために - Contra-indications of paracetamol can be of certain sorts - これらは、それが生成の言葉です:

  "domain": [ 
       "be", 
       "can", 
       "certain", 
       "contra", 
       "contra-indications", 
       "contraindications", 
       "indications", 
       "of", 
       "paracetamol", 
       "sorts" 
      ] 
+0

私はあなたに感謝した後だったまさにです!昨夜、空白文字トークナイザを使う考えがありました! –