Dont use PrefixQuery, only FuzzyQuery. There you pass in the whole term (with prefix) and define how many characters are the prefix.
----- Uwe Schindler H.-H.-Meier-Allee 63, D-28213 Bremen http://www.thetaphi.de eMail: u...@thetaphi.de > -----Original Message----- > From: Lukas Österreicher [mailto:lukas.oesterreic...@austria.real.com] > Sent: Monday, April 19, 2010 5:00 PM > To: java-user@lucene.apache.org > Subject: Re: Combining PrefixQuery and FuzzyQuery > > Well, how would this look like in code? > Currently I have the prefix query like this: > > BooleanQuery bQuery = new BooleanQuery(); > PrefixQuery prefixQuery = new PrefixQuery(new Term("item.name", > termText)); > bQuery.add( prefixQuery, Occur.MUST); > > I dont see any class named PrefixTerm. > I'd appreciate it if you could show me how it is done in java code. > > Lukas > > Am 19.04.10 16:48 schrieb "Uwe Schindler" unter <u...@thetaphi.de>: > > > How about a fuzzy query with a prefix term? Its configureable. > > > > ----- > > Uwe Schindler > > H.-H.-Meier-Allee 63, D-28213 Bremen > > http://www.thetaphi.de > > eMail: u...@thetaphi.de > > > > > >> -----Original Message----- > >> From: Lukas Österreicher > [mailto:lukas.oesterreic...@austria.real.com] > >> Sent: Monday, April 19, 2010 4:43 PM > >> To: java-user@lucene.apache.org > >> Subject: Combining PrefixQuery and FuzzyQuery > >> > >> Hello. > >> > >> Is it possible to combine PrefixQuery and FuzzyQuery? > >> The search on a term should both be fuzzy but also match with > results > >> that > >> jut begin with that token (or an approximation of that token). > >> > >> If it is possible, can you give me an example on how to achieve > this? > >> > >> Currently I only use the PrefixQuery and performance is ok. > >> Would performance with such a combination be much worse? > >> > >> I would not even need a complete fuzzy search, it would suffice > >> To have the matching be done without caring for cases (this I > already > >> have > >> present by using a modified WhitespaceTokenizer which filters > >> To lower cases) and with also matching characters where accents > >> Also match, so e would match é and è. > >> > >> Finally, I would like to know how much sorting a string field > >> Which is not too long (containing track or album title) affects > >> performance > >> Copared to not providing any sorting parameters. > >> > >> Thanx in advance, > >> Lukas > > > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org > > For additional commands, e-mail: java-user-h...@lucene.apache.org > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org > For additional commands, e-mail: java-user-h...@lucene.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org For additional commands, e-mail: java-user-h...@lucene.apache.org