lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ian Lea <>
Subject Re: Example phrase query with lucene version 4
Date Tue, 12 Mar 2013 10:59:42 GMT
QueryParser qp = new QueryParser(Version.whatever, "somefield", new
Query q = qp.parse("\"The mouse gnawed the clothes of the king of Rome\"");

and q should be a PhraseQuery if I've got the quoting right.  Some of
those words might be stop words which might cause you problems
although probably not if you use the same analyzer and stop word list
at indexing and search time.

Search using q as you would for any other sort of query.

See also


On Tue, Mar 12, 2013 at 12:45 AM, Arlei Ferreira Farnetani Junior
<> wrote:
> Hello, could someone give me an example of how to conduct a search in an
> already built index with Lucene 4 mode phrase query using a specific
> analyzer. I tested here with the phrase the search query did not work, so would
> appreciate a small example of how to pursue the example of a simple sentence in
> a text, for example: The mouse gnawed the clothes of the king of Rome.

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

View raw message