Re: How to ignore a match if a given keyword is before/after another given keyword?

2021-04-14 Thread Aditya Varun Chadha
maybe you want (abstractly):

bool(must(term("f", "positive"), mustNot(phrase("f", "negative positive",
slop=1)))

On Thu, Apr 15, 2021 at 7:27 AM Jean Morissette 
wrote:

> Hi all,
>
> Does someone know if it's possible to search documents containing a given
> keyword only if this keyword is not followed or preceded or another given
> keyword?
>
> Thanks,
> Jean
>


-- 
Aditya


How to ignore a match if a given keyword is before/after another given keyword?

2021-04-14 Thread Jean Morissette
Hi all,

Does someone know if it's possible to search documents containing a given
keyword only if this keyword is not followed or preceded or another given
keyword?

Thanks,
Jean


Re: How to create a query to search for 2 words separated by 0-3 gaps?

2021-04-14 Thread Jean Morissette
Thank you for your response. It was exactly what I was looking for.

On Thu, 1 Apr 2021 at 14:40, Haoyu Zhai  wrote:

> Hi Jean,
> One thing I could come up with is to use IntervalQuery.
>
> Specifically you could create an IntervalQuery with IntervalSource of:
>
> Intervals.within(Intervals.term(word2), 3, Intervals.term(word1)))
>
> to search for word2 that appears within 3 positions of word1
>
> Best
> Patrick
>
> Jean Morissette  于2021年3月31日周三 下午9:00写道:
>
> > Does someone know how to create a query for searching 2 words separated
> by
> > 0, 1, 2 or 3 gaps?
> >
> > Thanks
> >
>