Return-Path: X-Original-To: apmail-lucene-java-user-archive@www.apache.org Delivered-To: apmail-lucene-java-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id DA5FA99EF for ; Thu, 1 Mar 2012 14:28:22 +0000 (UTC) Received: (qmail 47358 invoked by uid 500); 1 Mar 2012 14:28:20 -0000 Delivered-To: apmail-lucene-java-user-archive@lucene.apache.org Received: (qmail 47291 invoked by uid 500); 1 Mar 2012 14:28:20 -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 47282 invoked by uid 99); 1 Mar 2012 14:28:20 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 01 Mar 2012 14:28:20 +0000 X-ASF-Spam-Status: No, hits=-0.7 required=5.0 tests=RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of dameriangr@gmail.com designates 74.125.83.48 as permitted sender) Received: from [74.125.83.48] (HELO mail-ee0-f48.google.com) (74.125.83.48) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 01 Mar 2012 14:28:12 +0000 Received: by eeke49 with SMTP id e49so220531eek.35 for ; Thu, 01 Mar 2012 06:27:51 -0800 (PST) Received-SPF: pass (google.com: domain of dameriangr@gmail.com designates 10.112.102.68 as permitted sender) client-ip=10.112.102.68; Authentication-Results: mr.google.com; spf=pass (google.com: domain of dameriangr@gmail.com designates 10.112.102.68 as permitted sender) smtp.mail=dameriangr@gmail.com; dkim=pass header.i=dameriangr@gmail.com Received: from mr.google.com ([10.112.102.68]) by 10.112.102.68 with SMTP id fm4mr2490529lbb.7.1330612071545 (num_hops = 1); Thu, 01 Mar 2012 06:27:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:content-type:content-transfer-encoding; bh=5CTnYF7Tx7LveDkd3AmCHPaPA5sujyY7O2cBtpUdTv4=; b=JKcVhMEqYyi7K+oJn52hqhYXCciwxvOkYTJ3W03RKJyaT86FQyMeVfUOEoKXv9umUj xIgauPm6KFb4gekbafvfHldH/aGk40M+Dt1HTdsx3KVCunufcifEUiIPljORcHAXr5U6 iJMe7AKWj/StEgd90M9ymYISx5iuX5xl8nBLs= Received: by 10.112.102.68 with SMTP id fm4mr2039496lbb.7.1330612071464; Thu, 01 Mar 2012 06:27:51 -0800 (PST) Received: from [212.25.139.75] (wlanguest13975.eduroam.hj.se. [212.25.139.75]) by mx.google.com with ESMTPS id uc6sm3171999lbb.3.2012.03.01.06.27.50 (version=SSLv3 cipher=OTHER); Thu, 01 Mar 2012 06:27:51 -0800 (PST) Message-ID: <4F4F875B.7020508@gmail.com> Date: Thu, 01 Mar 2012 15:27:39 +0100 From: Damerian User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:10.0.2) Gecko/20120216 Thunderbird/10.0.2 MIME-Version: 1.0 To: java-user@lucene.apache.org Subject: Re: QueryParser strange behavior References: <4F4881BA.7030203@gmail.com> <4F4BDCB4.3020304@gmail.com> <4F4F75BE.3030201@gmail.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-7; format=flowed Content-Transfer-Encoding: 8bit X-Virus-Checked: Checked by ClamAV on apache.org ���� 1/3/2012 3:08 ��, �/� Ian Lea ������: > Not a clue. I suggest you post a small, complete and self-contained > (no external dependencies) program or test case that demonstrates the > problem. And your analyzer. > > > -- > Ian. > > > 2012/3/1 Damerian: >> Hello again! >> First of all thank you again for replying my amateur questions. >> I would like to rephrase my question because now what i described is not the >> case and its not a problem of input methods. >> >> I have made my custom analyzer which when indexing e.g the phrase "The quick >> Brown Fox" >> will produce the following tokens >> [The] >> [quick] >> [Brown Fox] >> >> when i use exactly the same analyser to construct a search query i get the >> following result: >> "With ProperNameAnalyzerThe quick Brown Fox parses to The quick Brown Fox >> query: contents:The contents:quick contents:Brown contents:Fox" >> which means that the analyzer fails to combine Brown and Fox into one token >> and make it a single term for the search as expected. >> Any insights on this? >> Once again thank you for your time and patience. >> >> ���� 28/2/2012 11:51 ��, �/� Ian Lea ������: >>> Then I don't know. Something trivial like white space? What does >>> line.equals("Jesus Christ") say? >>> >>> >>> -- >>> Ian. >>> >>> >>> On Mon, Feb 27, 2012 at 7:42 PM, Damerian wrote: >>>> ���� 27/2/2012 11:45 ��, �/� Ian Lea ������: >>>>> Does your analyzer look for a field called content, not contents? >>>>> >>>>> >>>>> -- >>>>> Ian. >>>>> >>>>> >>>>> On Sat, Feb 25, 2012 at 6:37 AM, Damerian >>>>> wrote: >>>>>> Hello! >>>>>> >>>>>> I have a small issue with the QueryParser in my program. >>>>>> It uses my custom filter to Parse its queries, but i get unexpexted >>>>>> results >>>>>> from when i am having an input from the keyboard >>>>>> To illustrate >>>>>> the code : >>>>>> Analyzer myAnalyzer = new ProperNameAnalyzer(); >>>>>> Query query = new QueryParser(Version.LUCENE_CURRENT, >>>>>> "content", >>>>>> myAnalyzer).parse("Jesus Christ"); >>>>>> //assertEquals(1, TestUtil.hitCount(searcher, query)); >>>>>> System.out.println("With ProperNameAnalyzer, Jesus Christ parses to >>>>>> " >>>>>> + >>>>>> query.toString("content")+ " >>>>>> query: >>>>>> " +query); >>>>>> >>>>>> >>>>>> will produce the following (expected ) output: >>>>>> With ProperNameAnalyzer, "Jesus Christ" parses to "Jesus Christ" query: >>>>>> contents:"Jesus Christ" >>>>>> >>>>>> Although with a small addition of keyboard iinteraction: >>>>>> BufferedReader in = null; >>>>>> String line = in.readLine(); >>>>>> Query query = new QueryParser(Version.LUCENE_CURRENT, >>>>>> "contents", >>>>>> analyzer).parse(line); >>>>>> System.out.println("With ProperNameAnalyzer, Jesus Christ parses to " >>>>>> + >>>>>> query.toString("contents")+ " >>>>>> query: >>>>>> " +query); >>>>>> >>>>>> Will produce the incorrect and unexpected output: >>>>>> With ProperNameAnalyzer, "Jesus Christ" parses to Jesus Christ query: >>>>>> contents:Jesus contents:Christ >>>>>> >>>>>> >>>>>> Any ideas why this may happen? >>>>>> Thanks in advance! >>>>>> >>>>>> >>>>>> --------------------------------------------------------------------- >>>>>> 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 >>>>> >>>> Thanks for the reply! >>>> No that's not the case... It was a typographic mistake here cause i took >>>> the >>>> code from my demo program (the one i use to test the code) i have the >>>> same >>>> name for the fields in both cases (hard coded and use input) >>>> regards! >>>> >>>> --------------------------------------------------------------------- >>>> 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 >>> >> >> --------------------------------------------------------------------- >> 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 > Hi! Thanks for the immediate reply, i just fixed it though! apparently the QueryParser consructs a query regardless of the analyzer's tokens I simply created my own booleanQuery by calling my custom analyzer and treating the user inputed query text as a stream. The result works perfectly! Thank you again for your time and patience! :-) --------------------------------------------------------------------- To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org For additional commands, e-mail: java-user-help@lucene.apache.org