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 Igor Shalyminov <is...@yandex-team.ru> on 2013/01/18 17:13:46 UTC

SpanNearQuery with two boundaries

Hello!

I want to perform search queries like this one:
word:"dog" \1 word:"runs" (\3 \10) word:"cat"

It is thus something like SpanNearQuery, but with two boundaries - minimum and maximum distance between the terms (which in the \1-case would be equal).
Syntax (as above, fictional:) itself doesn't matter, I just want to know if one is able to build this type of query based on existing (Lucene 4.0.0) query classes. 

-- 
Best Regards,
Igor Shalyminov

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Re: SpanNearQuery with two boundaries

Posted by Igor Shalyminov <is...@yandex-team.ru>.
Alan and Jack,

That's it, thank you!

-- 
Best Regards,
Igor

18.01.2013, 22:14, "Jack Krupansky" <ja...@basetechnology.com>:
> +1
>
> I think that accurately states the semantics of the operation you want.
>
> -- Jack Krupansky
>
> -----Original Message-----
> From: Alan Woodward
> Sent: Friday, January 18, 2013 1:08 PM
> To: java-user@lucene.apache.org
> Subject: Re: SpanNearQuery with two boundaries
>
> Hi Igor,
>
> You could try wrapping the two cases in a SpanNotQuery:
> SpanNot(SpanNear(runs, cat, 10), SpanNear(runs, cat, 3))
>
> That should return documents that have runs within 10 positions of cat, as
> long as they don't overlap with runs within 3 positions of cat.
>
> Alan Woodward
> www.flax.co.uk
>
> On 18 Jan 2013, at 16:13, Igor Shalyminov wrote:
>
>>  Hello!
>>
>>  I want to perform search queries like this one:
>>  word:"dog" \1 word:"runs" (\3 \10) word:"cat"
>>
>>  It is thus something like SpanNearQuery, but with two boundaries - minimum
>>  and maximum distance between the terms (which in the \1-case would be
>>  equal).
>>  Syntax (as above, fictional:) itself doesn't matter, I just want to know
>>  if one is able to build this type of query based on existing (Lucene
>>  4.0.0) query classes.
>>
>>  --
>>  Best Regards,
>>  Igor Shalyminov
>>
>>  ---------------------------------------------------------------------
>>  To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
>>  For additional commands, e-mail: java-user-help@lucene.apache.org
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Re: SpanNearQuery with two boundaries

Posted by Jack Krupansky <ja...@basetechnology.com>.
+1

I think that accurately states the semantics of the operation you want.

-- Jack Krupansky

-----Original Message----- 
From: Alan Woodward
Sent: Friday, January 18, 2013 1:08 PM
To: java-user@lucene.apache.org
Subject: Re: SpanNearQuery with two boundaries

Hi Igor,

You could try wrapping the two cases in a SpanNotQuery:
SpanNot(SpanNear(runs, cat, 10), SpanNear(runs, cat, 3))

That should return documents that have runs within 10 positions of cat, as 
long as they don't overlap with runs within 3 positions of cat.

Alan Woodward
www.flax.co.uk


On 18 Jan 2013, at 16:13, Igor Shalyminov wrote:

> Hello!
>
> I want to perform search queries like this one:
> word:"dog" \1 word:"runs" (\3 \10) word:"cat"
>
> It is thus something like SpanNearQuery, but with two boundaries - minimum 
> and maximum distance between the terms (which in the \1-case would be 
> equal).
> Syntax (as above, fictional:) itself doesn't matter, I just want to know 
> if one is able to build this type of query based on existing (Lucene 
> 4.0.0) query classes.
>
> -- 
> Best Regards,
> Igor Shalyminov
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Re: SpanNearQuery with two boundaries

Posted by Alan Woodward <al...@flax.co.uk>.
Hi Igor,

You could try wrapping the two cases in a SpanNotQuery:
	SpanNot(SpanNear(runs, cat, 10), SpanNear(runs, cat, 3))

That should return documents that have runs within 10 positions of cat, as long as they don't overlap with runs within 3 positions of cat.

Alan Woodward
www.flax.co.uk


On 18 Jan 2013, at 16:13, Igor Shalyminov wrote:

> Hello!
> 
> I want to perform search queries like this one:
> word:"dog" \1 word:"runs" (\3 \10) word:"cat"
> 
> It is thus something like SpanNearQuery, but with two boundaries - minimum and maximum distance between the terms (which in the \1-case would be equal).
> Syntax (as above, fictional:) itself doesn't matter, I just want to know if one is able to build this type of query based on existing (Lucene 4.0.0) query classes. 
> 
> -- 
> Best Regards,
> Igor Shalyminov
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>