You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by Ricardo Lopes <A4...@alunos.ipca.pt> on 2004/12/02 18:28:54 UTC
Re: Does QueryParser uses Analyzer ?
I tried luke and is great, i don't like the code but the tool is really
good.
I found the problem, but i don't understand why.
This was the old code (doesn't work) :
--------//-----------------
IndexSearcher searcher = new IndexSearcher("data");
BrazilianAnalyzer analyzer = new BrazilianAnalyzer();
// begin of code block that doesn't work
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
System.out.print("Query: ");
String line = in.readLine();
// end of code that doesn't work
Query query = QueryParser.parse(line, "contents", analyzer);
Hits hits = searcher.search(query);
System.out.println(hits.length() + " total matching documents");
-------------//------------
but if i replace the above code that doesn't work by this it works fine:
String line = "text to search";
This doesn't have anything to do with lucene, but why does it work if i
supply the code directly into the string and doesn't work usign the
inputstream?
Does it has something to do with the encoding or something like that ?
is it problem of the windows shell that passes the punctuation
characters in an incorrect way?
Thanks for your help
---------------------------------------------------------------------
To unsubscribe, e-mail: lucene-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: lucene-dev-help@jakarta.apache.org