You could also add a field with all the terms reversed during the indexation.
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. Luc -----Original Message----- From: jian chen [mailto:[EMAIL PROTECTED] Sent: donderdag 15 september 2005 18:22 To: java-user@lucene.apache.org Subject: Re: Small problem in searching 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]