lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Erik Hatcher <e...@ehatchersolutions.com>
Subject Re: Not able to retrieve hits for a phrase
Date Mon, 17 Apr 2006 12:33:11 GMT
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: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org


---------------------------------------------------------------------
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