QueryParser qp = new QueryParser(Version.whatever, "somefield", new WhateverAnalyzer()); 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 http://wiki.apache.org/lucene-java/LuceneFAQ#Why_am_I_getting_no_hits_.2BAC8_incorrect_hits.3F. -- Ian. On Tue, Mar 12, 2013 at 12:45 AM, Arlei Ferreira Farnetani Junior <farnet...@gmail.com> 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: java-user-unsubscr...@lucene.apache.org For additional commands, e-mail: java-user-h...@lucene.apache.org