You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by Sébastien Druon <dr...@gmail.com> on 2013/07/09 08:55:21 UTC

Search for a token appearing after another

Hello,

I am looking for a way to search for a token appearing after another and
retrieve tehir positions.

ex: T1 (...)* T2

I know the SpanTermQuery is doing similar when using the slop parameter,
but I do not want to limit the distance between T1 and T2.

Does anybody have an idea how to solve that problem?

Thanks in advance

Sébastien

Re: Search for a token appearing after another

Posted by Alan Woodward <al...@flax.co.uk>.
IIRC, SpanQueries try and match on the smallest interval possible.  So if you've got T1 … T1 … T2, then SpanNear(T1, T2) will match from the second T1.

Alan Woodward
www.flax.co.uk


On 9 Jul 2013, at 09:56, Sébastien Druon wrote:

> Thanks Alan,
> 
> Do you know if the search would exclude other occurences of T1 between T1
> and T2?
> 
> ex: T1 (...)* T1 (...)* T2 would not match?
> 
> Thanks again
> 
> Sébastien
> 
> 
> On 9 July 2013 09:48, Alan Woodward <al...@flax.co.uk> wrote:
> 
>> You can use Integer.MAX_VALUE as the slop parameter.
>> 
>> Alan Woodward
>> www.flax.co.uk
>> 
>> 
>> On 9 Jul 2013, at 07:55, Sébastien Druon wrote:
>> 
>>> Hello,
>>> 
>>> I am looking for a way to search for a token appearing after another and
>>> retrieve tehir positions.
>>> 
>>> ex: T1 (...)* T2
>>> 
>>> I know the SpanTermQuery is doing similar when using the slop parameter,
>>> but I do not want to limit the distance between T1 and T2.
>>> 
>>> Does anybody have an idea how to solve that problem?
>>> 
>>> Thanks in advance
>>> 
>>> Sébastien
>> 
>> 


Re: Search for a token appearing after another

Posted by Sébastien Druon <dr...@gmail.com>.
Thanks Alan,

Do you know if the search would exclude other occurences of T1 between T1
and T2?

ex: T1 (...)* T1 (...)* T2 would not match?

Thanks again

Sébastien


On 9 July 2013 09:48, Alan Woodward <al...@flax.co.uk> wrote:

> You can use Integer.MAX_VALUE as the slop parameter.
>
> Alan Woodward
> www.flax.co.uk
>
>
> On 9 Jul 2013, at 07:55, Sébastien Druon wrote:
>
> > Hello,
> >
> > I am looking for a way to search for a token appearing after another and
> > retrieve tehir positions.
> >
> > ex: T1 (...)* T2
> >
> > I know the SpanTermQuery is doing similar when using the slop parameter,
> > but I do not want to limit the distance between T1 and T2.
> >
> > Does anybody have an idea how to solve that problem?
> >
> > Thanks in advance
> >
> > Sébastien
>
>

Re: Search for a token appearing after another

Posted by Alan Woodward <al...@flax.co.uk>.
You can use Integer.MAX_VALUE as the slop parameter.

Alan Woodward
www.flax.co.uk


On 9 Jul 2013, at 07:55, Sébastien Druon wrote:

> Hello,
> 
> I am looking for a way to search for a token appearing after another and
> retrieve tehir positions.
> 
> ex: T1 (...)* T2
> 
> I know the SpanTermQuery is doing similar when using the slop parameter,
> but I do not want to limit the distance between T1 and T2.
> 
> Does anybody have an idea how to solve that problem?
> 
> Thanks in advance
> 
> Sébastien