lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Vishal Bathija" <>
Subject getting frequency of a phrase within documents
Date Tue, 11 Apr 2006 15:58:20 GMT
I am using phraseQuery to get the number of documents that the query
appers in using the hits. I would like to know if there is any way in
which i can get the number of times a phrase appears within each

I am currently  using  searching for the phrase "avoids deadlock"

phraseQuery query =new PhraseQuery();
searcher = new IndexSearcher(rd);
String temp ="avoids";
String temp2 ="deadlock";
Term synset2 = new Term("contents",temp);
Term ss = new Term("contents",temp2);
query.add( ss);
Hits hits =;
System.out.println("number of hits="+((HitIterator)hits.iterator()).length() );

Any help would be greatly appreciated.

Vishal Bathija
Graduate Student
Department of Computer Science & Systems Analysis
Miami University
Phone: (513)-461-9239

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message