What's the .toString on the query it parsed to? Keep in mind that
"*" isn't the proper regular expression to match everything - it
would be ".*" or some other pattern.
Erik
On Sep 7, 2006, at 7:41 AM, Luke Tan wrote:
Hi,
I am using code in
http://mail-archives.apache.org/mod_mbox/lucene-java-user/
200605.mbox/%
[EMAIL PROTECTED]
for wildcard search in phrase
but it seems that I can only search something like:
"one two three word*"
but not
"one * three word"
It throws error:
java.lang.NullPointerException
at java.util.Hashtable.get(Hashtable.java:336)
at org.apache.lucene.index.MultiReader.norms(MultiReader.java:163)
at org.apache.lucene.search.spans.SpanWeight.scorer
(SpanWeight.java:70)
at org.apache.lucene.search.IndexSearcher.search
(IndexSearcher.java:129)
at org.apache.lucene.search.IndexSearcher.search
(IndexSearcher.java:110)
at org.apache.lucene.search.Hits.getMoreDocs(Hits.java:65)
at org.apache.lucene.search.Hits.<init>(Hits.java:52)
at org.apache.lucene.search.Searcher.search(Searcher.java:53)
The query text is analyzed using this:
if (!StringUtils.isEmpty(queryText)) {
if (queryText.indexOf("*") == 0 || queryText.indexOf
("?") == 0)
return null;
if (queryText.indexOf(' ') != -1) {
SpanRegexQuery srq = new SpanRegexQuery(new Term(field,
queryText));
SpanFirstQuery sfq = new SpanFirstQuery(srq, 1);
return sfq;
}
}
Query getFieldQuery(String field, String queryText) throws
ParseException
Thanks
Luke
inside
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]