Counting occurrences of term containing more than one word

Hi,

I would like to count occurrences of a term what that term may contain more
than one word. For example I’ve a field with a text like “this is a nice
simple text, very nice text” and I need to count the occurrences of “simple
text”.

I’m able to search such documents by using QueryBuilders.textPhraseQuery(
field, “simple text” ), but when it comes to TermsFacet, the count is per
word. Is it possible to have facet for such case?

Thanks.

--

You can set a specific analyzer for facets.
Using a multifield type, you can define an analyzer for your searches and one
for the facets.

Then, you have to find the analyzer that answer to your needs.
For example, il you use a keyword analyzer, your facet will count the occurences
of "this is a nice simple text, very nice text"

Problem is here to find the right analyzer that can combine two words (like the
ngram but for words)!
I don't know if it exist.

David

Le 27 novembre 2012 à 13:47, barak barak.yaish@gmail.com a écrit :

Hi,

I would like to count occurrences of a term what that term may contain more
than one word. For example I’ve a field with a text like “this is a nice
simple text, very nice text” and I need to count the occurrences of “simple
text”.

I’m able to search such documents by using QueryBuilders.textPhraseQuery(
field, “simple text” ), but when it comes to TermsFacet, the count is per
word. Is it possible to have facet for such case?

Thanks.

--

--
David Pilato
http://www.scrutmydocs.org/
http://dev.david.pilato.fr/
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

--