lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject Multiple Analyzers
Date Sun, 30 Oct 2005 16:03:30 GMT

I am implementing a search that allows the user to toggle the Soundex and
Stem functionality on and off.  When the Soundex or Sten functions are not
on, the search will use the StandardAnalyzer as default.  I implemented the
Soundex (SoundexAnalyzer from book Lucene In Action) and Stem
(SnowballAnalyzer) analyzer successfully individually.  They only work if I
use the analyzers during both indexing and searching.  The problem I have
is that I seem to have to use one of the three analyzers or nothing.  I
heven't been able to combine them.  The following may help better to
understand what I am trying to achieve.  Any help would be greatly

Index using recursive TokenStream object.

public TokenStream tokenStream(String fieldName, Reader reader) {
      TokenStream result = new SoundexFilter (
                        new SnowballFilter (
                           new StopFilter (
LowerCaseFilter (

new StandardFilter (
new StandardTokenizer(reader))),

      return result;

If user selects Soundex function, use SoundexAnalyzer in query.
Else if user selects Stem option, use SnowballAnalyzer in query.
Else use StandardAnalyzer.

Daniel Clark, Senior Consultant
Sybase Federal Professional Services
6550 Rock Spring Drive, Suite 800
Bethesda, MD  20817
Office - (301) 896-1103
Office Fax - (301) 896-1604
Mobile - (703) 403-0340

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

View raw message