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

if(phraseQuery){
	PhraseQuery pQuery = new PhraseQuery();
	pQuery.add(new Term("contents", phraseString));
	pQuery.setSlop(0);
	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.

thanks.
-H

Erik Hatcher wrote:


---------------------------------------------------------------------
To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: lucene-user-help@jakarta.apache.org


Mime
View raw message