Lucene's WildcardQuery *does* support "postfix" queries - however
QueryParser does not allow such an expression to pass through. You
can create a WildcardQuery with a Term("field", "*whatever") and
search with that. All caveats about WildcardQuery, performance, and
maximum number of boolean clauses apply.
Erik
On Sep 15, 2005, at 12:22 PM, jian chen wrote:
Hi,
I think Lucene transforms the prefix match query into all sub
queries where
the searching for a prefix could result into search for all terms
that begin
with that prefix.
For "postfix" match, I think you need to do more work than relying on
Lucene's query parser.
You can iterate over the terms and do an "endsWith()" call, and if
there is
a match, then, perform a normal Lucene search for that term.
So, effectively, you do the same thing as prefix match,
conceptually loop
over all available terms in your dictionary and find all the terms
to be
prepared for actual searching.
This might be slow. What you might want to speed up the performance
is, you
can store all the available terms in-memory, and looping through
all unique
terms is a breeze. This is what google used for their prototype search
engine when they were way back in the 1998s. (I guess :-)
Cheers,
Jian
On 9/15/05, tirupathi reddy <[EMAIL PROTECTED]> wrote:
Hi guys,
I have some problem while searching using Lucene. Say I have some
thing
like "tirupathireddy" or "venkatreddy" in the index. When i search
for
string "reddy" I have to get those things (i.e. "tirupathireddy" and
"venkatreddy"). I have read in Query syntax of Lucene that * will
not be
given at the starting of the search string. SO how can I achiev
that. I am
in very much need of that. So please help me out.
WIth Regards,
TirupatiReddy Manyam.
Tirupati Reddy Manyam
24-06-08,
Sundugaullee-24,
79110 Freiburg
GERMANY.
Phone: 00497618811257
cell : 004917624649007
---------------------------------
Yahoo! for Good
Click here to donate to the Hurricane Katrina relief effort.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]