Return-Path: Delivered-To: apmail-lucene-java-user-archive@www.apache.org Received: (qmail 71144 invoked from network); 1 Apr 2005 17:14:01 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 1 Apr 2005 17:14:01 -0000 Received: (qmail 28868 invoked by uid 500); 1 Apr 2005 17:13:41 -0000 Delivered-To: apmail-lucene-java-user-archive@lucene.apache.org Received: (qmail 28835 invoked by uid 500); 1 Apr 2005 17:13:41 -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 28809 invoked by uid 99); 1 Apr 2005 17:13:41 -0000 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received-SPF: pass (hermes.apache.org: local policy) Received: from Unknown (HELO ehatchersolutions.com) (69.55.225.129) by apache.org (qpsmtpd/0.28) with ESMTP; Fri, 01 Apr 2005 09:13:40 -0800 Received: by ehatchersolutions.com (Postfix, from userid 504) id BEFA313E2122; Fri, 1 Apr 2005 12:13:36 -0500 (EST) Received: from [128.143.167.108] (d-128-167-108.bootp.Virginia.EDU [128.143.167.108]) by ehatchersolutions.com (Postfix) with ESMTP id 35B4113E2006 for ; Fri, 1 Apr 2005 12:13:12 -0500 (EST) Mime-Version: 1.0 (Apple Message framework v619.2) In-Reply-To: <1582287727.20050401180703@keljob.com> References: <424C0E62.10002@colaborativa.net> <297f128e646a94719e98205e5e42c4bc@ehatchersolutions.com> <773719179.20050401150918@keljob.com> <3e9becd32d830a737fc6da54ea0d1e36@ehatchersolutions.com> <1582287727.20050401180703@keljob.com> Content-Type: text/plain; charset=US-ASCII; format=flowed Message-Id: <4367f81557fe22108fce438e2b3c0b22@ehatchersolutions.com> Content-Transfer-Encoding: 7bit From: Erik Hatcher Subject: Re: Re[4]: Analyzer don't work with wildcard queries, snowball analyzer. Date: Fri, 1 Apr 2005 12:13:12 -0500 To: java-user@lucene.apache.org X-Mailer: Apple Mail (2.619.2) X-Spam-Checker-Version: SpamAssassin 3.0.1 (2004-10-22) on javelina X-Spam-Status: No, score=-3.2 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.0.1 X-Spam-Level: X-Virus-Checked: Checked X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N On Apr 1, 2005, at 11:07 AM, Sven Duzont wrote: > EH> I presume your analyzer normalized accented characters? Which > analyzer > EH> is that? > > Yes, i'm using a custom analyser for indexing / searching, ti consists > in : > - FrenchStopFilter > - IsoLatinFilter (this is the one that will replace accented > characters) Could you share that filter with the community? > EH> You will need to employ some form of character normalization on > EH> wildcard queries too. > > thanks, it works succeffuly, code snippet following > > --- > sven > > /*----------------------- CODE ----------------------------*/ > > private static Query CreateCustomQuery(Query query) > { > if(query instanceof BooleanQuery) { > final BooleanClause[] bClauses = ((BooleanQuery) > query).getClauses(); > > // The first clause is required > if(bClauses[0].prohibited != true) > bClauses[0].required = true; Why do you flip the required flag like this? > > // Will parse each clause to remove accents if needed > Term term; > for (int i = 0; i < bClauses.length; i++) { > if(bClauses[i].query instanceof WildcardQuery) { > term = ((WildcardQuery)bClauses[i].query).getTerm(); > bClauses[i].query = new WildcardQuery(new Term(term.field(), > > ISOLatin1AccentFilter.RemoveAccents(term.text().toLowerCase()))); > } What about handling BooleanQuery's nested within a BooleanQuery? You'll need some recursion. Erik > if(bClauses[i].query instanceof PrefixQuery) { > term = ((PrefixQuery)bClauses[i].query).getPrefix(); > bClauses[i].query = new PrefixQuery(new Term(term.field(), > > ISOLatin1AccentFilter.RemoveAccents(term.text().toLowerCase()))); > // toLowerCase because the text is lowercased during indexation > } > } > } > else if(query instanceof WildcardQuery) { > final Term term = ((WildcardQuery)query).getTerm(); > query = new WildcardQuery(new Term(term.field(), > > ISOLatin1AccentFilter.RemoveAccents(term.text().toLowerCase()))); > } > else if(query instanceof PrefixQuery) { > final Term term = ((PrefixQuery)query).getPrefix(); > query = new PrefixQuery(new Term(term.field(), > > ISOLatin1AccentFilter.RemoveAccents(term.text().toLowerCase()))); > } > return query; > } > > /*----------------------- END OF CODE ----------------------------*/ > > EH> Erik > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org > For additional commands, e-mail: java-user-help@lucene.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org For additional commands, e-mail: java-user-help@lucene.apache.org