lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Allen Atamer" <>
Subject designing a dictionary filter with multiple word entries
Date Tue, 08 Apr 2008 21:59:24 GMT
My dictionary filter currently implements next() and everything works well
when dictionary entries are replaced one-to-one. For example:   Can =>

A problem arises when I try to replace it with more than one word. Going
through next() I encounter "shutdown".  But the dictionary entry takes
Shutdown => shut down (two words). I construct a replacement term according
the to the instructions in the Javadoc, but the search does not match any
substrings "shut" or "down" in my database. I debugged it and found
QueryParser is converting my replaced text into PhraseQuery objects instead
of BooleanQuery objects.

My code to replace the string is below:

		Token teachToken = new Token();
		char [] termBuffer = teachToken.termBuffer();
		for (int i = 0; i < replacementTerm.length(); i++) {
			termBuffer[i] = replacementTerm.charAt(i);
		return teachToken;

Instead of [field1]:shut down, it is searching with [field1]:"shut down".

How can I construct the replacement terms so that queries are formed
properly, and I don't violate the next() contract?

Thanks a bunch!

No virus found in this outgoing message.
Checked by AVG. 
Version: 7.5.519 / Virus Database: 269.22.9/1365 - Release Date: 4/8/2008
7:30 AM

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

View raw message