lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joe Amstadt <tekka...@yahoo.com>
Subject Lucene PhraseQuery Problem No Hits
Date Fri, 10 Feb 2006 21:04:40 GMT
Problem.
I can add one or multiple TermQuery's to the BooleanQuery for searching and I am getting Hits
when i preform the search on various indexes.  If i add a PhraseQuery to the BooleanQuery
on a search i get zero hits.

         Some Background Information:

Indexing using standard anaylzer.
Indexing text documents into various indexes based on their year created.
Using Lucene 1.4.3.
Lucene Document fields used are Keyword and Text.
Searching using BooleanQuery and adding TermQuery and PhraseQuery to the BooleanQuery to preform
a search on the various indexes.

Example 1:
PhraseQuery pq_query = new PhraseQuery();
pq_query.add( new Term( "body", "\"circus parade\"" ) );
<BooleanQuery>.add( pq_query, true, false);

I get zero Hits on the search.  In the document there is a phrase that goes "circus parade
downtown"

Also i have tried this code as well and nothing.  Also i have messed with the <PhraseQuery>.setSlop()
and still zero hits.

try{

     bq_query.add((PhraseQuery)QueryParser.parse( "\"circus parade\"", "body", new  StandardAnalyzer()
), true, false) ;
}catch(ParseException pe){

    pe.printStackTrace();
}

Example2: 
<BooleanQuery>.add( new TermQuery ( new Term  ( "body", "circus" ) ) , true, false );

I get Hits from the search

Example 3:
<BooleanQuery>.add( new TermQuery ( new Term  ( "body", "circus" ) ) , true, false );
<BooleanQuery>.add( new TermQuery ( new Term  ( "body", "parade" ) ) , true, false );
<BooleanQuery>.add( new TermQuery ( new Term  ( "body", "downtown" ) ) , true, false
);

I get Hits from the search



Any help on this matter would be great!


		
---------------------------------
 Yahoo! Mail
 Use Photomail to share photos without annoying attachments.
Mime
  • Unnamed multipart/alternative (inline, 8-Bit, 0 bytes)
View raw message