Return-Path: Delivered-To: apmail-lucene-java-user-archive@www.apache.org Received: (qmail 97961 invoked from network); 1 Feb 2010 16:41:39 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 1 Feb 2010 16:41:39 -0000 Received: (qmail 35161 invoked by uid 500); 1 Feb 2010 16:41:36 -0000 Delivered-To: apmail-lucene-java-user-archive@lucene.apache.org Received: (qmail 35086 invoked by uid 500); 1 Feb 2010 16:41:36 -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 35076 invoked by uid 99); 1 Feb 2010 16:41:36 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 01 Feb 2010 16:41:36 +0000 X-ASF-Spam-Status: No, hits=1.2 required=10.0 tests=SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (athena.apache.org: local policy) Received: from [85.25.71.29] (HELO mail.troja.net) (85.25.71.29) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 01 Feb 2010 16:41:27 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by mail.troja.net (Postfix) with ESMTP id D304745FA1C for ; Mon, 1 Feb 2010 17:41:04 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at mail.troja.net Received: from mail.troja.net ([127.0.0.1]) by localhost (megaira.troja.net [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id LRQ2uolzNASY for ; Mon, 1 Feb 2010 17:40:53 +0100 (CET) Received: from VEGA (unknown [134.102.249.78]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by mail.troja.net (Postfix) with ESMTPSA id 51A8C45FA18 for ; Mon, 1 Feb 2010 17:40:53 +0100 (CET) From: "Uwe Schindler" To: References: <27348933.post@talk.nabble.com> <359a92831001271815y532f5007le8b89845a5d7f8e1@mail.gmail.com> <3b23ce091001272051g2ef79c7fsde1e835955b1dcad@mail.gmail.com>,<27406592.post@talk.nabble.com> In-Reply-To: Subject: RE: During the wild card search, will lucene 2.9.0 to convert the search string to lower case? Date: Mon, 1 Feb 2010 17:41:08 +0100 Message-ID: <000c01caa35d$5b071fc0$11155f40$@de> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Mailer: Microsoft Office Outlook 12.0 Thread-Index: AcqjW22f/h1Uj1Z7QI67PqyBv1BkjwAAdHtg Content-Language: de Only query parser does the lower casing. For such a special case, I = would suggest to use a PrefixQuery or WildcardQuery directly and not use = query parser. ----- Uwe Schindler H.-H.-Meier-Allee 63, D-28213 Bremen http://www.thetaphi.de eMail: uwe@thetaphi.de > -----Original Message----- > From: java8964 java8964 [mailto:java8964@hotmail.com] > Sent: Monday, February 01, 2010 5:27 PM > To: java-user@lucene.apache.org > Subject: During the wild card search, will lucene 2.9.0 to convert the > search string to lower case? >=20 >=20 > I noticed a strange result from the following test case. For wildcard > search, my understanding is that lucene will NOT use any analyzer on > the query string. But as the following simple code to show, it looks > like that lucene will lower case the search query in the wildcard > search. Why? If not, why the following test case show the search hits > as one for lower case wildcard search, but not for the upper case = data? > My original data is NOT analyzed, so they should be stored as the > original data in the index segment, right? >=20 > Lucene version: 2.9.0 >=20 > JDK version: JDK 1.6.0_17 >=20 >=20 > public class IndexTest1 { > public static void main(String[] args) { > try { > Directory directory =3D new RAMDirectory(); > IndexWriter writer =3D new IndexWriter(directory, new > StandardAnalyzer(Version.LUCENE_CURRENT), > IndexWriter.MaxFieldLength.UNLIMITED); > Document doc =3D new Document(); > doc.add(new Field("title", "BBB CCC", Field.Store.YES, > Field.Index.NOT_ANALYZED)); > writer.addDocument(doc); > doc =3D new Document(); > doc.add(new Field("title", "ddd eee", Field.Store.YES, > Field.Index.NOT_ANALYZED)); > writer.addDocument(doc); >=20 > writer.close(); >=20 > IndexSearcher searcher =3D new IndexSearcher(directory, > true); > PerFieldAnalyzerWrapper wrapper =3D new > PerFieldAnalyzerWrapper(new StandardAnalyzer(Version.LUCENE_CURRENT)); > wrapper.addAnalyzer("title", new KeywordAnalyzer()); > Query query =3D new QueryParser("title", > wrapper).parse("title:BBB*"); > System.out.println("hits of title =3D " + > searcher.search(query, 100).totalHits); > query =3D new QueryParser("title", > wrapper).parse("title:ddd*"); > System.out.println("hits of title =3D " + > searcher.search(query, 100).totalHits); > searcher.close(); > } catch (Exception e) { > System.out.println(e); > } > } > } >=20 > The output: > hits of title =3D 0 > hits of title =3D 1 >=20 >=20 > _________________________________________________________________ > Hotmail: Trusted email with powerful SPAM protection. > http://clk.atdmt.com/GBL/go/201469227/direct/01/ --------------------------------------------------------------------- To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org For additional commands, e-mail: java-user-help@lucene.apache.org