# Decompounder in query\_string analyzer

**URL:** <https://discuss.elastic.co/t/decompounder-in-query-string-analyzer/11749>\
**Category:** Elasticsearch\
**Created:** [April 30, 2013, 2:53pm UTC](https://discuss.elastic.co/t/decompounder-in-query-string-analyzer/11749 "2013-04-30T14:53:19Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![singer](https://avatars.discourse-cdn.com/v4/letter/s/e0b2c6/32.png) [@singer](https://discuss.elastic.co/u/singer)\
**Post date:** [April 30, 2013, 2:53pm UTC](https://discuss.elastic.co/t/decompounder-in-query-string-analyzer/11749/1 "2013-04-30T14:53:19Z")

</div>

Hi everyone,

I'm building a search engine for a German website and therefore have to  
deal with compound word filters...

The main problem currently are compound nouns that are sometimes written as  
one word and sometimes divided by dashes, e.g. "Schlossbergtunnel" and  
"Schlossberg-Tunnel". A query for either "Schlossbergtunnel" or  
"Schlossberg-Tunnel" (or "Schlossberg Tunnel") should match both  
"Schlossbergtunnel" and "Schlossberg-Tunnel".

My current approach is to use dictionary\_decompounder with "schlossberg"  
and "tunnel" provided in the word list:

index:  
analysis:  
filter :  
decompound\_filter:  
type : dictionary\_decompounder  
word\_list: ["schlossberg", "tunnel"]

This works well for the indexer. But the problem is the analyzer used for  
the query\_string query:

- If I don't include the decompound filter in the query\_string analyzer,  
a query for "schlossbergtunnel" does not find documents containing  
"Schlossberg-Tunnel".
- If the decompounder is included in the query analyzer, the query for  
"schlossbergtunnel" matches "Schlossberg-Tunnel". But it also matches  
documents where only either "Schlossberg" or "Tunnel" occur which is not  
what I want. It seems like the tokens expanded by the decompound filter are  
joined using OR.

In other words: The query string "schlossbergtunnel" using the decompound  
filter behaves like "schlossbergtunnel OR schlossberg OR tunnel", but what  
I need is "schlossbergtunnel OR (schlossberg AND tunnel)".  
Any ideas how to achieve this?

Thanks for any hints,  
Christoph

--  
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).  
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, 2:39am UTC](https://discuss.elastic.co/t/decompounder-in-query-string-analyzer/11749/2 "2017-07-06T02:39:05Z")

</div>


