Does anyone know of a way to get elasticsearch to return a word count?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Does anyone know of a way to get elasticsearch to return a word count?

Nikolas Everett
It looks like my user interface returns a word count and it was sneakily implemented by faulting text in from the database and running str_word_count on it.  I'd rather have elasticsearch calculate the number of words in my text so I don't have to load to show search results.  Does anyone know a good way to do that?  I assume it'd make more sense to store the word count on index into another field and just fetch it.

Nik

--
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 [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.
Reply | Threaded
Open this post in threaded view
|

Re: Does anyone know of a way to get elasticsearch to return a word count?

simonw-2
can you go a bit more into detail here? are you asking for the frequency of a word across the entire index or within a document? How do you need to select words?

simon

On Thursday, October 10, 2013 11:52:04 PM UTC+2, Nikolas Everett wrote:
It looks like my user interface returns a word count and it was sneakily implemented by faulting text in from the database and running str_word_count on it.  I'd rather have elasticsearch calculate the number of words in my text so I don't have to load to show search results.  Does anyone know a good way to do that?  I assume it'd make more sense to store the word count on index into another field and just fetch it.

Nik

--
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 [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.
Reply | Threaded
Open this post in threaded view
|

Re: Does anyone know of a way to get elasticsearch to return a word count?

Nikolas Everett
Just the number of terms in some field in the document. It is is a field I both query and highlight. I'd be happy with something approximate. I saw today I might be able to do a bit of math on the field norm to get it. 

Sent from my iPhone

On Oct 11, 2013, at 5:17 PM, simonw <[hidden email]> wrote:

can you go a bit more into detail here? are you asking for the frequency of a word across the entire index or within a document? How do you need to select words?

simon

On Thursday, October 10, 2013 11:52:04 PM UTC+2, Nikolas Everett wrote:
It looks like my user interface returns a word count and it was sneakily implemented by faulting text in from the database and running str_word_count on it.  I'd rather have elasticsearch calculate the number of words in my text so I don't have to load to show search results.  Does anyone know a good way to do that?  I assume it'd make more sense to store the word count on index into another field and just fetch it.

Nik

--
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 [hidden email].
For more options, visit 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 [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.
Reply | Threaded
Open this post in threaded view
|

Re: Does anyone know of a way to get elasticsearch to return a word count?

simonw-2
the field norm might help but it's hard to access and it's a 8bit float value that includes the boosts so it might be quite lossy? What you could do in master is using a TermVector and consume the field in the client since it contains all terms for a field in a document. 

On Friday, October 11, 2013 11:25:54 PM UTC+2, Nikolas Everett wrote:
Just the number of terms in some field in the document. It is is a field I both query and highlight. I'd be happy with something approximate. I saw today I might be able to do a bit of math on the field norm to get it. 

Sent from my iPhone

On Oct 11, 2013, at 5:17 PM, simonw <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="IyBNOp1vOv4J">simon.w...@elasticsearch.com> wrote:

can you go a bit more into detail here? are you asking for the frequency of a word across the entire index or within a document? How do you need to select words?

simon

On Thursday, October 10, 2013 11:52:04 PM UTC+2, Nikolas Everett wrote:
It looks like my user interface returns a word count and it was sneakily implemented by faulting text in from the database and running str_word_count on it.  I'd rather have elasticsearch calculate the number of words in my text so I don't have to load to show search results.  Does anyone know a good way to do that?  I assume it'd make more sense to store the word count on index into another field and just fetch it.

Nik

--
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 <a href="javascript:" target="_blank" gdf-obfuscated-mailto="IyBNOp1vOv4J">elasticsearc...@googlegroups.com.
For more options, visit 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 [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.