lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Luke Tan" <tans...@gmail.com>
Subject SpanRegexQuery causes error
Date Thu, 07 Sep 2006 11:41:02 GMT
Hi,

I am using code in
http://mail-archives.apache.org/mod_mbox/lucene-java-user/200605.mbox/%3CBED850C725E74F47A0F69CC0EE9AB64D02BA6A9C@CORPUSMX40B.corp.emc.com%3E

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

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message