lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paul Elschot <>
Subject Re: SpanQuery problem
Date Sun, 14 Sep 2008 20:36:08 GMT
Op Sunday 14 September 2008 19:36:38 schreef Darren Govoni:
> Hi,
>   I am seeing odd behavior with SpanNearQuery.
> The problem is that with multiple fields, all fields beyond the first
> one 'car' are not seen by the span. I didn't think the span meant to
> sets of the same field, but rather to terms within a given field.
> Document 1. 1 field (word)
> word: car
> word: cars
> word: cars wash
> word: cars lot
> SpanNearyQuery with slop of 0. Wrapped by SpanFirstQuery with slop of
> 1. Term query within is "word","cars*". No results found.

There is no SpanPrefixQuery for cars* in Lucene. You'll need to
expand the prefix into indexed terms to create a SpanOrQuery
yourself. This is fairly straightforward from PrefixQuery and
Alternatively, have a look at the surround query parser in contrib
for a working example.

Paul Elschot

> If I remove the first field word: car, it works. Also, if I increase
> the slop, it will return results from only the first amount of fields
> in the slop rather than terms within the field value.
> Is what I am seeing the correct behavior? Doesn't seem like it.
> What I am trying to do is span _within_ EACH field and match phrases
> that begin with "cars*". Shouldn't be too hard to do I thought.
> Darren
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message