lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ian Lea <ian....@gmail.com>
Subject Re: QueryParser strange behavior
Date Thu, 01 Mar 2012 14:08:45 GMT
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 <dameriangr@gmail.com>:
> 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<dameriangr@gmail.com>  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<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
>>>
>> ---------------------------------------------------------------------
>> 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


Mime
View raw message