How do you search for a phrase using Lucene Phrasequery.
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   surekha_Kopparti
Posted On:   Monday, August 7, 2006 09:57 AM

/* Building phrase query */

PhraseQuery pQuery = new PhraseQuery();
Term term = new Term("content", phrase);
pQuery.add(term);
BooleanQuery query = new BooleanQuery();
query.add(pQuery, Occur.MUST);
Hits hits = searcher.search(query);
return (hits);

The above code doesnot work??
Am I missing something

About | Sitemap | Contact