cancel
Showing results for 
Search instead for 
Did you mean: 

Count number of specific word in a document

webroro
Champ in-the-making
Champ in-the-making
Hi Alfresco's gurus,

I'd like to use the search service to count the number founds of a specific word. For example, I'd like to do a query to count the number of word 'amount' in a document (full text search). The result should be 0 to n items.

Do you know a Lucene query or sample of code to do that?

Kind regards
Thanks in advance
2 REPLIES 2

anditola
Champ in-the-making
Champ in-the-making
Hi,

I am looking for a solution for the same requirement. I am very new to Alfresco, but I know that the underlying Lucene Engine has a concept called Term Frequency Vector: It is a data structure containing a given Document's term and frequency information. See http://hudson.zones.apache.org/hudson/job/Lucene-trunk/javadoc//org/apache/lucene/index/TermFreqVect...

This Term Frequency Vector can be retrieved from an IndexReader. See http://hudson.zones.apache.org/hudson/job/Lucene-trunk/javadoc//org/apache/lucene/index/IndexReader....

This is really easy, BUT only possible, when Term Vectors are stored during indexing. And here is my problem: I don't know if Alfresco does this per default (1). And, if Alfresco does not, if and how it is possible to enable it without touching the source code (2).

I suppose you can prove (1) with Luke, the Lucene Index Toolbox from http://www.getopt.org/luke, by examing one the indices, that Alfresco creates…

Kind regards

jpipkin
Champ in-the-making
Champ in-the-making
Any luck solving this problem. I would like to get the terms and their positions using the Lucene index.