lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Erick Erickson" <erickerick...@gmail.com>
Subject Exception in WildCardQuery
Date Fri, 07 Apr 2006 14:28:05 GMT
So I'm trying to do silly stuff, just to poke a bit at wildcard queries. So
sue me... But I ran across this....

And yes, I know that creating a wildcard query is dangerous and downright
silly when you don't have a wildcard in the term, but this still seems like
a case should, say, default to a simple query rather than throw an
exception....

Lucene 1.9.1

Query q1 = new WildcardQuery(new Term("Text", "a"));
.
.
.
Hits hits = searcher.search(q1);


Caught Exception
java.lang.StringIndexOutOfBoundsException: String index out of range: -1
    at java.lang.String.substring(Unknown Source)
    at org.apache.lucene.search.WildcardTermEnum.<init>(
WildcardTermEnum.java:65)
    at org.apache.lucene.search.WildcardQuery.getEnum(WildcardQuery.java:38)
    at org.apache.lucene.search.MultiTermQuery.rewrite(MultiTermQuery.java
:54)
    at org.apache.lucene.search.IndexSearcher.rewrite(IndexSearcher.java
:137)
    at org.apache.lucene.search.Query.weight(Query.java:92)
    at org.apache.lucene.search.Hits.<init>(Hits.java:41)
    at org.apache.lucene.search.Searcher.search(Searcher.java:44)
    at org.apache.lucene.search.Searcher.search(Searcher.java:36)
    at QuickTest.main(QuickTest.java:45)



FWIW
Erick

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