# Extending based on Thai language analyzer

**URL:** <https://discuss.elastic.co/t/extending-based-on-thai-language-analyzer/15655>\
**Category:** Elasticsearch\
**Created:** [February 7, 2014, 5:57am UTC](https://discuss.elastic.co/t/extending-based-on-thai-language-analyzer/15655 "2014-02-07T05:57:12Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Min\_Cha](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/min_cha/32/1131_2.png) [@Min\_Cha](https://discuss.elastic.co/u/Min_Cha)\
**Post date:** [February 7, 2014, 5:57am UTC](https://discuss.elastic.co/t/extending-based-on-thai-language-analyzer/15655/1 "2014-02-07T05:57:12Z")

</div>

Hi folks.

I would like to develop for a searching system for Thai language.  
First of all, I found Thai analyzer and it seems like good.

But It doesn`t meet my whole requirement so I would like to extends it.  
For example, I would like to add nGram token filter on the Thai analyzer.

How to do this?  
Please, give me some advice.

--  
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 [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/32a6dc5c-b3c2-43ab-b5c1-ef8a54f17c11%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/32a6dc5c-b3c2-43ab-b5c1-ef8a54f17c11%40googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [February 10, 2014, 12:45pm UTC](https://discuss.elastic.co/t/extending-based-on-thai-language-analyzer/15655/2 "2014-02-10T12:45:36Z")

</div>

Hey,

you can easily create custom analyzers, which use the thai analyzer and the  
ngram token filter. See

> **[Elasticsearch Platform — Find real-time answers at scale](https://www.elastic.co)**
>
> Power insights and outcomes with the Elasticsearch Platform and AI. See into your data and find answers that matter with enterprise solutions designed to help you build, observe, and protect. Try Elasticsearch free today.

--Alex

On Fri, Feb 7, 2014 at 6:57 AM, Min Cha [minslovey@gmail.com](mailto:minslovey@gmail.com) wrote:

> Hi folks.
> 
> I would like to develop for a searching system for Thai language.  
> First of all, I found Thai analyzer and it seems like good.
> 
> But It doesn`t meet my whole requirement so I would like to extends it.  
> For example, I would like to add nGram token filter on the Thai analyzer.
> 
> How to do this?  
> Please, give me some advice.
> 
> --  
> 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 [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> To view this discussion on the web visit  
> [https://groups.google.com/d/msgid/elasticsearch/32a6dc5c-b3c2-43ab-b5c1-ef8a54f17c11%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/32a6dc5c-b3c2-43ab-b5c1-ef8a54f17c11%40googlegroups.com)  
> .  
> For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
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 [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/CAGCwEM\_bzxS7M1XRJa5Obi8FuyxxjoMQP4FkJCf6pwWWXYRPew%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAGCwEM_bzxS7M1XRJa5Obi8FuyxxjoMQP4FkJCf6pwWWXYRPew%40mail.gmail.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Min\_Cha](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/min_cha/32/1131_2.png) [@Min\_Cha](https://discuss.elastic.co/u/Min_Cha)\
**Post date:** [February 17, 2014, 2:08am UTC](https://discuss.elastic.co/t/extending-based-on-thai-language-analyzer/15655/3 "2014-02-17T02:08:48Z")

</div>

OK. I also know about custom analyzer.

But ThaiWordFilter is not aliased so I can`t use it. Alternatively, I can use following. But ThaiWordFilterFactory doesn`t have a zero-argument constructor so when  
I use a following setting, an error occurs.

If I know how to use a factory which has an one-argument constructor or to  
extend based on ThaiAnalyzer, I can resolve this problem.

{  
"analyzer": {  
"thai\_with\_ngram": {  
"type": "custom",  
"tokenizer": "standard",  
"filters": ["standard", "lowercase", "thai", "thai\_stop", "ngram"]  
}  
},  
"filter": {  
"thai": {  
"type": "org.apache.lucene.analysis.th.ThaiWordFilterFactory" \<-- An  
error occurs because of lack of a zero-argument constructor.  
},  
"thai\_stop": {  
"type": "stop",  
"stopwords\_path": "org/apache/lucene/analysis/th/stopwords.txt"  
},  
"ngram": { your ngram configuration here }  
}  
}

2014년 2월 10일 월요일 오후 9시 45분 36초 UTC+9, Alexander Reelsen 님의 말:

> Hey,
> 
> you can easily create custom analyzers, which use the thai analyzer and  
> the ngram token filter. See
> 
> [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/analysis-custom-analyzer.html)
> 
> --Alex
> 
> On Fri, Feb 7, 2014 at 6:57 AM, Min Cha \<[mins...@gmail.com](mailto:mins...@gmail.com) \<javascript:\>\>wrote:
> 
> > Hi folks.
> > 
> > I would like to develop for a searching system for Thai language.  
> > First of all, I found Thai analyzer and it seems like good.
> > 
> > But It doesn`t meet my whole requirement so I would like to extends it.  
> > For example, I would like to add nGram token filter on the Thai analyzer.
> > 
> > How to do this?  
> > Please, give me some advice.
> > 
> > --  
> > 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 [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com) \<javascript:\>.  
> > To view this discussion on the web visit  
> > [https://groups.google.com/d/msgid/elasticsearch/32a6dc5c-b3c2-43ab-b5c1-ef8a54f17c11%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/32a6dc5c-b3c2-43ab-b5c1-ef8a54f17c11%40googlegroups.com)  
> > .  
> > For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
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 [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/9b02ae32-c7a8-4c9a-a6d3-48095bb84f97%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/9b02ae32-c7a8-4c9a-a6d3-48095bb84f97%40googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 6, 2017, 1:49am UTC](https://discuss.elastic.co/t/extending-based-on-thai-language-analyzer/15655/4 "2017-07-06T01:49:46Z")

</div>


