yes its quite possible.
1.you need to create term which you need to search.
eg.
Term term = new Term("yourfield","yourword");

2. then create a TermDoc enum.
TermDocs provides an interface for enumerating <document, frequency> pairs
for a term.

TermDocs t = new
FilterIndexReader(IndexReader.open("youindex")).termDocs(term);

3.Iterate through each of the terms and count the occurrence.
int count = 0;
 while(td.next()){
                    count+=td.freq());
  }

Hope it helped,
Regards,
Dipesh

On Thu, Nov 13, 2008 at 4:30 AM, Fco. Mario Barcala Rodríguez <
[EMAIL PROTECTED]> wrote:

> Hello:
>
> I am new to LUCENE and I am testing some issues about it. I can retrieve
> the number of documents which satisfies a query, but I don't find how to
> obtain the number of terms which match it.
>
> For example, if I search for the word "house", I want to obtain the
> number of times the word occurs (not the number of documents).
>
> Is it possible to do it in LUCENE?
>
> Thanks in advance,
>
>  Mario Barcala
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>


-- 
----------------------------------------
"Help Ever Hurt Never"- Baba

Reply via email to