lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Erick Erickson" <erickerick...@gmail.com>
Subject Re: Positions in SpanFirst
Date Wed, 21 Feb 2007 13:16:38 GMT
I'm not sure you can, since all the interfaces I use alter the increment
between successive terms, but I'll be the first to admit that there are many
nooks and crannies that I don't know about... But I suspect that a negative
increment is not supported intentionally....

But I really doubt you want to do this due to the consequences. Consider in
your example the terms would have the following offsets
first 0
bit 1
second 0
part 1
third 0
section 1

Now think about a proximity query "first section"~1. This would produce a
hit because you've changed the whole sense of what offsets mean. Is this
really a good thing?

I suspect that the guys who really know things about the internals could
provide some good suggestions if you gave them a better idea of what it is
you're trying to accomplish and why you think SpanFirst helps accomplish
that....


Best
Erick

On 2/21/07, Antony Bowesman <adb@teamware.com> wrote:
>
> Hi,
>
> I have a field to which I add several bits of information, e.g.
>
> doc.add(new Field("x", "first bit"));
> doc.add(new Field("x", "second part"));
> doc.add(new Field("x", "third section"));
>
> I am using SpanFirstQuery to search them with something like:
>
> while...
>    SpanTermQuery stquery = new SpanTermQuery(new Term("x",
> termStr[incFactor]));
>    query = new SpanFirstQuery(stquery, incFactor);
>    incFactor++
>
> but a search for
>
> "first", span pos 1
> "bit", span pos 2
>
> gets a match, but
>
> "second", span pos 1
> "part", span pos 2
>
> fails.  How can I get the first term position for each word in each Field
> added
> to the document for the same field name to be 1, so that the SpanFirst
> works.
>
> Antony
>
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message