Return-Path: Delivered-To: apmail-lucene-java-dev-archive@www.apache.org Received: (qmail 24836 invoked from network); 16 Jun 2009 19:05:21 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 16 Jun 2009 19:05:21 -0000 Received: (qmail 11746 invoked by uid 500); 16 Jun 2009 19:05:32 -0000 Delivered-To: apmail-lucene-java-dev-archive@lucene.apache.org Received: (qmail 11660 invoked by uid 500); 16 Jun 2009 19:05:32 -0000 Mailing-List: contact java-dev-help@lucene.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: java-dev@lucene.apache.org Delivered-To: mailing list java-dev@lucene.apache.org Received: (qmail 11652 invoked by uid 99); 16 Jun 2009 19:05:32 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 16 Jun 2009 19:05:32 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.140] (HELO brutus.apache.org) (140.211.11.140) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 16 Jun 2009 19:05:28 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 58867234C044 for ; Tue, 16 Jun 2009 12:05:07 -0700 (PDT) Message-ID: <246010332.1245179107347.JavaMail.jira@brutus> Date: Tue, 16 Jun 2009 12:05:07 -0700 (PDT) From: "Mark Miller (JIRA)" To: java-dev@lucene.apache.org Subject: [jira] Commented: (LUCENE-1581) LowerCaseFilter should be able to be configured to use a specific locale. In-Reply-To: <585858505.1238285690569.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/LUCENE-1581?page=3Dcom.atlassia= n.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=3D127= 20298#action_12720298 ]=20 Mark Miller commented on LUCENE-1581: ------------------------------------- So it sounds like we may end up closing this with the solution being the co= llation filters in contrib? It sounds like a direct core fix is not the imm= ediate cards? > LowerCaseFilter should be able to be configured to use a specific locale. > ------------------------------------------------------------------------- > > Key: LUCENE-1581 > URL: https://issues.apache.org/jira/browse/LUCENE-1581 > Project: Lucene - Java > Issue Type: Improvement > Reporter: Digy > Attachments: TestTurkishCollation.java > > > //Since I am a .Net programmer, Sample codes will be in c# but I don't th= ink that it would be a problem to understand them. > // > Assume an input text like "=C4=B0" and and analyzer like below > {code} > =09public class SomeAnalyzer : Analyzer > =09{ > =09=09public override TokenStream TokenStream(string fieldName, System.IO= .TextReader reader) > =09 { > =09=09TokenStream t =3D new SomeTokenizer(reader); > =09=09 t =3D new Lucene.Net.Analysis.ASCIIFoldingFilter(t); > =09=09=09t =3D new LowerCaseFilter(t); > =09=09 return t; > =09=09} > =20 > =09} > {code} > =09 > ASCIIFoldingFilter will return "I" and after, LowerCaseFilter will return > =09"i" (if locale is "en-US")=20 > =09or=20 > =09"=C4=B1' if(locale is "tr-TR") (that means,this token should be input = to another instance of ASCIIFoldingFilter) > So, calling LowerCaseFilter before ASCIIFoldingFilter would be a solution= , but a better approach can be adding > a new constructor to LowerCaseFilter and forcing it to use a specific loc= ale. > {code} > public sealed class LowerCaseFilter : TokenFilter > { > /* +++ */System.Globalization.CultureInfo CultureInfo =3D System.= Globalization.CultureInfo.CurrentCulture; > public LowerCaseFilter(TokenStream in) : base(in) > { > } > /* +++ */ public LowerCaseFilter(TokenStream in, System.Globaliz= ation.CultureInfo CultureInfo) : base(in) > /* +++ */ { > /* +++ */ this.CultureInfo =3D CultureInfo; > /* +++ */ } > =09=09 > public override Token Next(Token result) > { > result =3D Input.Next(result); > if (result !=3D null) > { > char[] buffer =3D result.TermBuffer(); > int length =3D result.termLength; > for (int i =3D 0; i < length; i++) > /* +++ */ buffer[i] =3D System.Char.ToLower(buffer[i]= ,CultureInfo); > return result; > } > else > return null; > } > } > {code} > DIGY --=20 This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online. --------------------------------------------------------------------- To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org For additional commands, e-mail: java-dev-help@lucene.apache.org