lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Vanlerberghe, Luc" <>
Subject RE: Small problem in searching
Date Fri, 16 Sep 2005 12:08:11 GMT
You could also add a field with all the terms reversed during the

So documents containing "tirupathireddy" or "venkatreddy" would have
"ydderihtapurit" and "yddertaknev" in the reversed field.
If you detect that the user entered a suffix query like "*reddy",
transform it into a prefix query like "ydder*" on the reversed field.


-----Original Message-----
From: jian chen [] 
Sent: donderdag 15 september 2005 18:22
Subject: Re: Small problem in searching


I think Lucene transforms the prefix match query into all sub queries
the searching for a prefix could result into search for all terms that
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
a match, then, perform a normal Lucene search for that term. 

So, effectively, you do the same thing as prefix match, conceptually
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,
can store all the available terms in-memory, and looping through all
terms is a breeze. This is what google used for their prototype search 
engine when they were way back in the 1998s. (I guess :-)



On 9/15/05, tirupathi reddy <> wrote:
> Hi guys,
> I have some problem while searching using Lucene. Say I have some
> 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
> 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
> Phone: 00497618811257
> cell : 004917624649007
> ---------------------------------
> Yahoo! for Good
> Click here to donate to the Hurricane Katrina relief effort.

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

View raw message