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 ik...@daegis.com on 2011/08/26 18:30:17 UTC

Possible to use span queries to avoid stepping over null index positions

Hello,
In our indexes we have a field that is a combination of other various metadata fields (i.e. subject, from, to, etc.). Each field that is added has a null position at the beginning. As an example, in Luke the field data looks like:

null_1 this is a test subject null_1 ikoelliker email address

If someone searches this field using a NEAR or WITHIN style query for "subject email"~10. This message will be found. Is it possible to use Span Queries to avoid stepping over null position?

Thanks,
Ian Koelliker

RE: Possible to use span queries to avoid stepping over null index positions

Posted by ik...@daegis.com.
I don’t think I can use span-term(null_1). That is not a specific value I indexed, but a value put into the index when we call token.setPositionIncrement(2) on the first token in the token stream, essentially skipping a position.

-----Original Message-----
From: Trejkaz [mailto:trejkaz@trypticon.org]
Sent: Saturday, August 27, 2011 9:59 AM
To: java-user@lucene.apache.org
Subject: Re: Possible to use span queries to avoid stepping over null index positions

On Sat, Aug 27, 2011 at 2:30 AM,  <ik...@daegis.com> wrote:
> Hello,
> In our indexes we have a field that is a combination of other various metadata fields (i.e. subject, from, to, etc.). Each field that is added has a null position at the beginning. As an example, in Luke the field data looks like:
>
> null_1 this is a test subject null_1 ikoelliker email address
>
> If someone searches this field using a NEAR or WITHIN style query for "subject email"~10. This message will be found. Is it possible to use Span Queries to avoid stepping over null position?

Seems like you could:

    span-not(
      span-near(
        span-term(subject)
        span-term(email)
        10 ),
      span-term(null_1))

This is similar to tricks I have seen to return span matches in the
same sentence.

TX

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



Re: Possible to use span queries to avoid stepping over null index positions

Posted by Trejkaz <tr...@trypticon.org>.
On Sat, Aug 27, 2011 at 2:30 AM,  <ik...@daegis.com> wrote:
> Hello,
> In our indexes we have a field that is a combination of other various metadata fields (i.e. subject, from, to, etc.). Each field that is added has a null position at the beginning. As an example, in Luke the field data looks like:
>
> null_1 this is a test subject null_1 ikoelliker email address
>
> If someone searches this field using a NEAR or WITHIN style query for "subject email"~10. This message will be found. Is it possible to use Span Queries to avoid stepping over null position?

Seems like you could:

    span-not(
      span-near(
        span-term(subject)
        span-term(email)
        10 ),
      span-term(null_1))

This is similar to tricks I have seen to return span matches in the
same sentence.

TX

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