The javadoc for SpanFirstQuery says it is a special case of
SpanPositionRangeQuery so maybe you can use the latter directly,
although you might need to know the position of the last term which
might be a problem.

Alternatives might include reversing the terms and using SpanFirst or
adding a special "thisistheend" token to each field and using
SpanNearQuery for dog and thisistheend with suitable value for slop
and inOrder = true.

Or take the last term and index it in a separate field so you can just
search for lastterm: dog.


--
Ian.


On Tue, Dec 11, 2012 at 3:19 PM, Hasenberger, Josef
<josef.hasenber...@zetcom.com> wrote:
> Hi,
>
> I wonder if there is a way to use a SpanQuery to find documents with fields 
> that end with a certain term.
> Kind of the oppoisite of SpanFirstQuery, i.e. "SpanLastQuery", if you want.
>
> What I would like to do:
> Find terms that are at the end of a field.
>
> Example:
> Assume the following field content: "the quick brown fox jumps over the lazy 
> dog".
> I would like to find all documents that have "dog" at the end of the field.
>
> Any idea, how I can achieve this?
>
> Thanks a lot and best regards,
>
> Josef
>
>
>

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

Reply via email to