This concept is called Proximity Search in general. In Lucene they are achieved using SpanQuery.
On Thu, Feb 12, 2015 at 10:10 PM, Maisnam Ns <maisnam...@gmail.com> wrote: > Hi, > > Can someone help me if this use case is possible or not with lucene > > Use case: I have a string say 'Japan' appearing in 10 documents and I want > to get back , say some results which contain two words before 'Japan' and > two words after 'Japan' may be something like this ' Economy of Japan is > growing' etc. > > If it is not possible where should I look for such queries > > Thanks >