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?
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.
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?
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.