lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Lukas Österreicher <>
Subject SpanFirstQuery and PrefixQuery combined?
Date Tue, 23 Mar 2010 10:03:18 GMT

I¹m trying to do a search over an index with names.

This is how I currently create a document of the index

document.add(new Field("id", item.getItemId().toString(), Field.Store.YES,
document.add(new Field("", item.getAutoCompleteText(),
Field.Store.YES, Field.Index.ANALYZED));
document.add(new Field("item.type", item.getAutoCompleteType().name(),
field.Store.YES, Field.Index.NOT_ANALYZED_NO_NORMS));

I wish to try to search by, but only get results
that start with the term.
SpanFirstQuery would allow me to do this, however it is not a PrefixQuery,

If I have an "The Best of Elvis" in the index,
I would find a match if I search for "The" but not if I just search
For "Th".
What I would basically like to do is some term that looks like this:

But so far It seemes this is not possible.
Am I correct?
Is there another way to do this?

I cannot just do I normal PrefixQuery since it will find me a result
If I search for ³Best² in the above scenario, but I only want matches
for: ³T², ³Th² and ³The², and if possible also for ³The Bes², ³The Best² and
³The Best o²,
But not for ³Best² or ³Elvis².

Can you help me?
Thanx, Lukas

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