Get Number of Hits in a larger Text foreach search Term

Hello,

I am now in my third day of research on that topic. I am using ElasticSearch with Tire in my Rails app. The most important search functionality is where users can search in larger Texts (CVs of People), if the text has the right keywords in it. e.g. "Java AND Oracle" will show all texts having keyword Java and keyword Oracle in it. Everthing works fine so far.
But I am requested if the search results can return the number of hits in a document. So maybe like first result (5 times Java, 3 time Oracle), second result (7 times java, 1 time oracle), ...

Is there a possibility to display the number of matching words in a result? I couldn't find anything in the docs and even in this forum. I am sorry, when I just didn't see it. Please help!

Thank you a lot
Florigee

Elasticsearch does not easily provide the number of matching words in a
result. You can turn on debugging for each query and parse the Explain
object, which should have a list of all the term frequencies matched.

It might sound like it would be more work to parse the explain object
instead of just looking at the content return yourself, but the term
frequencies in explain are after analysis, so you get a count of the query
term after synonyms, stemmers, filtering, etc...

I am not a JSON user, does JSON having something like XPath? It would be
almost trivial parsing the explain result with something like XPath.

Cheers,

Ivan

On Sun, Oct 14, 2012 at 3:50 AM, florigee florian.goerlitz@gmail.comwrote:

Hello,

I am now in my third day of research on that topic. I am using
Elasticsearch
with Tire in my Rails app. The most important search functionality is where
users can search in larger Texts (CVs of People), if the text has the right
keywords in it. e.g. "Java AND Oracle" will show all texts having keyword
Java and keyword Oracle in it. Everthing works fine so far.
But I am requested if the search results can return the number of hits in a
document. So maybe like first result (5 times Java, 3 time Oracle), second
result (7 times java, 1 time oracle), ...

Is there a possibility to display the number of matching words in a result?
I couldn't find anything in the docs and even in this forum. I am sorry,
when I just didn't see it. Please help!

Thank you a lot
Florigee

--
View this message in context:
http://elasticsearch-users.115913.n3.nabble.com/Get-Number-of-Hits-in-a-larger-Text-foreach-search-Term-tp4023952.html
Sent from the Elasticsearch Users mailing list archive at Nabble.com.

--

--