2020年7月24日 星期五

[elasticsearch] Elasticsearch hunspell stemming dictionary remove word avoid stemming process 修改 hunspell 字典讓某字不stemming

Elasticsearch hunspell stemming dictionary remove word avoid stemming process 修改 hunspell 字典讓某字不stemming

假設想要讓 binding 不做 stemming
en_US.dic 中把 G rule拿掉
bind/AUGS -> bind/AUS

G rule in en_US.aff
SFX G   e     ing        e
SFX G   0     ing

GET  myindex/_analyze
{
  "field": "title",
  "text": "binding"
}
{
  "tokens" : [
    {
      "token" : "binding",
      "start_offset" : 0,
      "end_offset" : 7,
      "type" : "word",
      "position" : 0
    },
    {
      "token" : "bind",
      "start_offset" : 0,
      "end_offset" : 7,
      "type" : "word",
      "position" : 0
    }
  ]
}


After

GET  myindex/_analyze
{
  "field": "title",
  "text": "binding"
}
{
  "tokens" : [
    {
      "token" : "binding",
      "start_offset" : 0,
      "end_offset" : 7,
      "type" : "word",
      "position" : 0
    }
  ]
}

沒有留言:

張貼留言