Return-Path: Delivered-To: apmail-lucene-java-user-archive@www.apache.org Received: (qmail 79225 invoked from network); 30 Oct 2005 16:03:58 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 30 Oct 2005 16:03:58 -0000 Received: (qmail 87775 invoked by uid 500); 30 Oct 2005 16:03:54 -0000 Delivered-To: apmail-lucene-java-user-archive@lucene.apache.org Received: (qmail 87749 invoked by uid 500); 30 Oct 2005 16:03:53 -0000 Mailing-List: contact java-user-help@lucene.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: java-user@lucene.apache.org Delivered-To: mailing list java-user@lucene.apache.org Received: (qmail 87738 invoked by uid 99); 30 Oct 2005 16:03:53 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 30 Oct 2005 08:03:53 -0800 X-ASF-Spam-Status: No, hits=2.5 required=10.0 tests=DNS_FROM_RFC_ABUSE,DNS_FROM_RFC_POST,NO_REAL_NAME X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: local policy) Received: from [192.138.151.43] (HELO inergen.sybase.com) (192.138.151.43) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 30 Oct 2005 08:03:49 -0800 Received: from smtp1.sybase.com (sybgate [10.22.97.84]) by inergen.sybase.com with ESMTP id j9UG3W306165 for ; Sun, 30 Oct 2005 08:03:32 -0800 (PST) Received: from gwwest.sybase.com (localhost [127.0.0.1]) by smtp1.sybase.com with ESMTP id IAA01695 for ; Sun, 30 Oct 2005 08:03:31 -0800 (PST) Subject: Multiple Analyzers To: java-user@lucene.apache.org X-Mailer: Lotus Notes Release 6.5 September 26, 2003 Message-ID: From: Daniel.Clark@sybase.com Date: Sun, 30 Oct 2005 11:03:30 -0500 X-MIMETrack: Serialize by Router on gwwest/SYBASE(Release 6.5.4|March 27, 2005) at 10/30/2005 08:03:31 AM MIME-Version: 1.0 Content-type: text/plain; charset=US-ASCII X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N 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 appreciated. Indexing ======== Index using recursive TokenStream object. public TokenStream tokenStream(String fieldName, Reader reader) { TokenStream result = new SoundexFilter ( new SnowballFilter ( new StopFilter ( new LowerCaseFilter ( new StandardFilter ( new StandardTokenizer(reader))), StandardAnalyzer.STOP_WORDS))); return result; } Searching ========== 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: java-user-unsubscribe@lucene.apache.org For additional commands, e-mail: java-user-help@lucene.apache.org