lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Hetan Shah <Hetan.S...@Sun.COM>
Subject Re: Phrase Query
Date Tue, 27 Jul 2004 18:42:16 GMT
Works for me.
Here is what I am striving to achieve.

phraseString = 	request.getParameter("phrase");
if (phraseString.length() > 0){
	phraseQueryString = "\""+phraseString+("\"");
	phraseQuery = true;
	queryString = phraseQueryString;

	PhraseQuery pQuery = new PhraseQuery();
	pQuery.add(new Term("contents", phraseString));
	QueryParser qP = new QueryParser();
	query = qP.parse(phraseString);

This is piece of the code, what I intend to do is if there is any 
keyword entered in the Exact Phrase field of the form I want to use the 
phrase query other wise use regular Query.

Please correct the code if you'll think it is not correct. I am still 
learning about search and Lucene in general.


Erik Hatcher wrote:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message