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-unsubscr...@lucene.apache.org
For additional commands, e-mail: java-user-h...@lucene.apache.org

Reply via email to