lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Hostetter <hossman_luc...@fucit.org>
Subject Re: Lucene PhraseQuery Problem No Hits
Date Sat, 11 Feb 2006 18:27:28 GMT

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

the terms you add to a phrase query need to be exactly equal to the
individual terms that your analyzer would have generated when indexingthe
documents you now want to match.  in your case, it looks like you are
using StandardAnalyzer -- which never generates a term with a space in it.

try this....

    PhraseQuery pq_query = new PhraseQuery();
    pq_query.add(new Term("body", "circus"));
    pq_query.add(new Term("body", "parade"));


:      bq_query.add((PhraseQuery)QueryParser.parse( "\"circus parade\"", "body", new  StandardAnalyzer()
), true, false) ;

...off the top of my head, that seems like it should work.  have you
looked at the toString on the resulting query object to see what it's
structure is?  Compare it with the toString of a query built hte way i
describe above and see if anything is different.



-Hoss


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