NarimanN2 / ParsiAnalyzer

Persian Analyzer For Elasticsearch.
151 stars 28 forks source link

Use filters independently #3

Closed kazemisoroush closed 4 years ago

kazemisoroush commented 6 years ago

I need to use each filters inside parsi analyzer independently in a custom analyzer. In fact I need to extend parsi analyzer in custom way. Is there a way to achieve that?

NarimanN2 commented 6 years ago

Hi, sorry for the delay. Please first download the latest version of ParsiAnalyzer. You can use filters independently using their names. There are three token filters called parsi_normalizer, parsi_stem_filter and parsi_stop_filter. also there is a character filter called zwnj_filter. for example if you want to create a ParsiAnalyzer without stemming:

PUT my_index
{
  "settings": {
    "analysis": {
      "analyzer": {
        "parsi_no_stem": {
          "type":      "custom",
          "tokenizer": "standard",
          "char_filter": [
            "zwnj_filter"
         ],
          "filter": [
            "parsi_normalizer",
            "parsi_stop_filter"
          ]
        }
      }
    }
  }
}
masoudjahromi commented 5 years ago

Hi, This query it did not work.

Elasticsearch Version: 6.5.0 ParsiAnalyzer Version: 1.0

PUT my_index
{
  "settings": {
    "analysis": {
      "analyzer": {
        "parsi_no_stem": {
          "type": "custom",
          "tokenizer": "standard",
          "filter": [
            "parsi_normalizer",
            "parsi_stop_filter"
          ]
        }
      }
    }
  }
}

This error happened:

Custom Analyzer [parsi_no_stem] failed to find filter under name [parsi_normalizer]

How can I use parsi analyzer with edge_ngram_tokenizer?