lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Damerian <dameria...@gmail.com>
Subject Re: QueryParser strange behavior
Date Mon, 27 Feb 2012 19:42:44 GMT
Στις 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<dameriangr@gmail.com>  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


Mime
View raw message