customized analyzers behave

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

customized analyzers behave

narinder.izap
Hi All,

  I am trying to write down a custom analyzer like as follows : 


"analysis": {

       "tokenizer": {

         "my_edge_ngram_tokenizer": {

           "type": "edgeNGram",

           "min_gram": "1",

           "max_gram": "20",

           "token_chars": []

         }

       },

       "filter": {

         "ys_word_delimiter": {

           "type": "word_delimiter",

           "stem_english_possessive": "False"

         }

       },

       "analyzer": {

         "ys_search_analyzer": {

           "type": "custom",

           "tokenizer": "my_edge_ngram_tokenizer",

           "filter": [

             "ys_word_delimiter",

             "lowercase"

           ]

         }

       }

     }


Now I need to have a behave for analyzer that if i search for title as "ca,usa" OR "ca, usa", both should be searchable using this analyzer. But right now its searching only what has been saved, So if the title is saved with space then space is searchable and if title is saved without space, its searchable without space.


So I tried to add "trim" filter in the filter list. Expecting, after tokenizer, the token filter will run on the token generated, so " usa" will be convered to "usa" token. so whether the title is without space or with space, the read and write time will finally be changed into a trimmed token after bypassing this analyzer.


If I am mistaken in understanding the analysis process, please let me know, and if yes, please let me know how can i achieve this goal.


All help will be appreciated. Thanks in advance.


--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/44e06283-a86c-4d40-b5c4-2b7122d98493%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: customized analyzers behave

Mark Walkom-2
Are you using the same analyser for indexing and querying?

On 13 February 2015 at 16:16, Narinder Kaur <[hidden email]> wrote:
Hi All,

  I am trying to write down a custom analyzer like as follows : 


"analysis": {

       "tokenizer": {

         "my_edge_ngram_tokenizer": {

           "type": "edgeNGram",

           "min_gram": "1",

           "max_gram": "20",

           "token_chars": []

         }

       },

       "filter": {

         "ys_word_delimiter": {

           "type": "word_delimiter",

           "stem_english_possessive": "False"

         }

       },

       "analyzer": {

         "ys_search_analyzer": {

           "type": "custom",

           "tokenizer": "my_edge_ngram_tokenizer",

           "filter": [

             "ys_word_delimiter",

             "lowercase"

           ]

         }

       }

     }


Now I need to have a behave for analyzer that if i search for title as "ca,usa" OR "ca, usa", both should be searchable using this analyzer. But right now its searching only what has been saved, So if the title is saved with space then space is searchable and if title is saved without space, its searchable without space.


So I tried to add "trim" filter in the filter list. Expecting, after tokenizer, the token filter will run on the token generated, so " usa" will be convered to "usa" token. so whether the title is without space or with space, the read and write time will finally be changed into a trimmed token after bypassing this analyzer.


If I am mistaken in understanding the analysis process, please let me know, and if yes, please let me know how can i achieve this goal.


All help will be appreciated. Thanks in advance.


--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/44e06283-a86c-4d40-b5c4-2b7122d98493%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/CAEYi1X-MQtRVs_9fDVciGcjd%3DGHd0D-L0q79pgfbwJZiLFhBVw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.