This could be related to the analyzer you used during indexing. Be aware that matches are *exact* including case.

        Erik

On Apr 17, 2006, at 1:34 AM, Vishal Bathija wrote:

Hi,
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= IndexReader.open("C:\\Documents and Settings\\Owner\\My
Documents\\Thesis\\luceneTest\\index");
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]);
 query.add(phrTerm[u]);                 
  }

System.out.println("Query"+query.toString() );
Hits hits = searcher.search(query);     
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?


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

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to