Mario, Does this help: http://hudson.zones.apache.org/hudson/job/Lucene-trunk/javadoc//org/apache/lucene/index/TermFreqVector.html
Plus: http://hudson.zones.apache.org/hudson/job/Lucene-trunk/javadoc//org/apache/lucene/index/IndexReader.html#method_summary (look for "getTerm.Freq...") Otis -- Sematext -- http://sematext.com/ -- Lucene - Solr - Nutch ________________________________ From: "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> To: java-user@lucene.apache.org Sent: Thursday, November 13, 2008 3:35:24 AM Subject: Re: About counting term hits > 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()); > } > This helps but, what about combining this with a search criteria? I mean to obtain the number of times the term "house" occurs in document between year 1999 and 2005 (another field of documents). I don't find anything related in classes used by you. >> 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 > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]