lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Vishal Bathija" <>
Subject Not able to retrieve hits for a phrase
Date Mon, 17 Apr 2006 05:34:35 GMT
I am not able to retrieve the number of hits for a particular phrase .
The code below retrieves the hits only for certain phrases. The code
snippet that I use is

rd="C:\\Documents and Settings\\Owner\\My
PhraseQuery query =new PhraseQuery();			
searcher = new IndexSearcher(rd);			
Term[] phrTerm=new Term[phraseTerms.length];
for(int u=0; u<phraseTerms.length;u++)
  phrTerm[u]=new Term("contents",phraseTerms[u]);

System.out.println("Query"+query.toString() );
Hits hits =;	
System.out.println("Number of hits :"+hits.length());

Number of hits is 0 for some phrases even though the phrase is present
in some of the documents.

This retrieves the hits for certain phrases such as

"avoids deadlock" but it does not work for a phrase such as
"Prevents Data Loss"

I am not sure what the problem could be as none of these phrases have
any special characters.  Do I need to use any other type of query?

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