Awesome! Thanks a lot Steven! This is exactly what I wanted.
Hi Sirish, Have you looked at SpanQuery's yet?: http://lucene.apache.org/java/3_0_2/api/all/org/apache/lucene/search/spans/package-summary.html See also this Lucid Imagination blog post by Mark Miller: http://www.lucidimagination.com/blog/2009/07/18/the-spanquery/ One common technique, instead of using a larger-than-normal position increment gap between sentences, is using a sentence boundary token like '$' or something else that won't ever itself be the target of search. Quoting from a post Mark Miller made to the lucene-user list last year <http://www.lucidimagination.com/search/document/c9641cbb1a3bf928/multiline_regex_with_lucene>): First you inject special marker tokens as your paragraph/ sentence markers, then you use a SpanNotQuery that looks for a SpanNearQuery that doesn't intersect with a SpanTermQuery containing the special marker term. Mark's suggestion would work for your within-sentence case, and for the case where you don't care about sentence boundaries, you can use SpanNearQuery without the SpanNotQuery. Using this technique, a single field should serve all of your needs. Steve -- View this message in context: http://lucene.472066.n3.nabble.com/Issue-with-sentence-specific-search-tp1644352p1645072.html Sent from the Lucene - Java Users mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org For additional commands, e-mail: java-user-h...@lucene.apache.org