lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Yonik Seeley <>
Subject Re: "Starts with" query?
Date Thu, 05 Jan 2006 22:33:40 GMT
Off the top of my head:
1) also index the field untokenized and use a straight prefix query
2) index a magic token at the start of the title and include that in a
phrase query:
   "_START_ the quick"
3) use a SpanFirst query (but you have to make the Java Query object yourself)


On 1/5/06, Paul Smith <> wrote:
> I'm throwing myself at the mercy of the lucene community, I'm a bit
> brain dead today after looking after a screaming 3 month old baby for
> 4 hours last night...
> We have a 'title' field indexed as Field.Text(...), which works
> nicely, and has lots of good searching.
> However, this application is being ported from a DB based search,
> which had originally a "starts with" type search, and we need to
> support that.
> So, given "The quick brown fox jumped of the caffeine addicted
> software developer", if the user types "The quick*" we need to find
> only those that have a title that starts with, and NOT match
> documents that have "The quick" as a sequence of terms later in the
> title (ie don't match "blah blah the quick blah blah").
> Think SQL of " ....where title like 'The quick%'  ".
> How do I do that with Lucene?  I'm sure this a is a dumb question,
> and I know that Lucene's searching is way more useful than that, but
> you know these pesky compatibility requirements.....It's screwing
> with my unit tests because the new index search results are getting
> more results that the old db method.
> cheers,
> Paul Smith
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

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

View raw message