DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=16167>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND
INSERTED IN THE BUG DATABASE.
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=16167
Problem searching with WildCards and quotes
Summary: Problem searching with WildCards and quotes
Product: Lucene
Version: CVS Nightly - Specify date in submission
Platform: PC
OS/Version: Windows NT/2K
Status: NEW
Severity: Critical
Priority: Other
Component: QueryParser
AssignedTo: lucene-dev@jakarta.apache.org
ReportedBy: yuval_v@yahoo.com
Hello,
When I'm trying to search in an index, and the query has wildcards and quotes
(see example), Lucene doesn't find hits. It is needed for example to search for
a String that has white spaces in it.
Exaple:
My index contains Document with field which its name is the string "0", and
value is the string "1234".
The following code works fine, and finds 1 hit:
Code:
-----
String queryStr = "123*";
Query query = QueryParser.parse(queryStr, "0", new StandardAnalayzer());
Hits hits = myIndexSearcher.search(query);
System.out.println("Hits length: " + hits.length());
However, if the first line in the code will be:
String queryStr = "\"123*\"";
and not the original one (the string will have quotes in it (the first and last
characters are the character ")), the search won't find any hit!!!!
I've tried to put the * after the closing quote, or use parenthesis, but it
didn't help.
The quotes are important becasue I need the search with wildcards for strings
that have more than one word (for example "hello world"), and without quotes it
is impossible to search for it. However, with quotes ("\"hello w*\""), Lucene
doesn't find any hit. But then I've noticed that the problem isn't with the
white spaces, because you can see from my example that also without the white
space, there is no any hit.
Do you have a solution for it?
Yuval Vardi.
--
To unsubscribe, e-mail: <mailto:lucene-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:lucene-dev-help@jakarta.apache.org>
|