Lucene / Elasticsearch Analyzers

In Lucene, analyzer is a combination of tokenizer (splitter) + stemmer + stopword filter

In ElasticSearch, analyzer is a combination of

1. Character filter: “tidy up” a string before it is tokenize. Example: remove html tags
2. Tokenizer: MUST have a single tokenizer. It’s used to break up the string into individual terms or tokens
3. Token filter: change, add or remove tokens. Stemmer is a token filter, it is used to get base of word, for example: “happy”, “happiness” => “happi” (Snowball demo)

Reference:
https://www.elastic.co/guide/en/elasticsearch/guide/current/custom-analyzers.html
http://stackoverflow.com/questions/12836642/analyzers-in-elasticsearch

Demo:
http://snowball.tartarus.org/demo.php

Reference:
https://www.elastic.co/guide/en/elasticsearch/reference/current/analysis-snowball-analyzer.html
https://www.elastic.co/guide/en/elasticsearch/guide/current/analysis-intro.html

All About Analyzers:
https://www.elastic.co/blog/found-text-analysis-part-1
https://www.elastic.co/blog/found-text-analysis-part-2

Testing Lucene Analyzers with elasticsearch
http://jontai.me/blog/2012/10/testing-lucene-analyzers-with-elasticsearch/
“Here’s an awesome plugin on github repo. It’s somewhat extension of Analyze API. Found it on official elastic plugin list.

What’s great is that it shows tokens with all their attributes after every single step. With this it is easy to debug analyzer configuration and see why we got such tokens and where we lost the ones we wanted.”
https://github.com/johtani/elasticsearch-extended-analyze
https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-analyze.html

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s