lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Vishal Bathija" <vishalbath...@gmail.com>
Subject getting frequency of a phrase within documents
Date Tue, 11 Apr 2006 15:58:20 GMT
Hi,
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
document.

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(synset2);
query.add( ss);
Hits hits = searcher.search(query);
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
Oxford,Ohio
Phone: (513)-461-9239

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Mime
View raw message