[jira] Created: (LUCENE-543) Wildcard query with no wildcard characters in the term throws StringIndexOutOfBounds exception

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

[jira] Created: (LUCENE-543) Wildcard query with no wildcard characters in the term throws StringIndexOutOfBounds exception

JIRA jira@apache.org
Wildcard query with no wildcard characters in the term throws StringIndexOutOfBounds exception
----------------------------------------------------------------------------------------------

         Key: LUCENE-543
         URL: http://issues.apache.org/jira/browse/LUCENE-543
     Project: Lucene - Java
        Type: Improvement

  Components: Search  
    Versions: 1.9    
 Environment: linux and windows, JRE 1.4.2_06 Lucene 1.9.1
    Reporter: Erick Erickson
    Priority: Minor



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)


From Erik Hatcher

Feel free to log this as a bug report in our JIRA issue tracker.  It
seems like a reasonable change to make, such that a WildcardQuery
without a wildcard character would behave like TermQuery.

--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

[jira] Assigned: (LUCENE-543) Wildcard query with no wildcard characters in the term throws StringIndexOutOfBounds exception

JIRA jira@apache.org
     [ http://issues.apache.org/jira/browse/LUCENE-543?page=all ]

Michael Busch reassigned LUCENE-543:
------------------------------------

    Assignee: Michael Busch

> Wildcard query with no wildcard characters in the term throws StringIndexOutOfBounds exception
> ----------------------------------------------------------------------------------------------
>
>                 Key: LUCENE-543
>                 URL: http://issues.apache.org/jira/browse/LUCENE-543
>             Project: Lucene - Java
>          Issue Type: Improvement
>          Components: Search
>    Affects Versions: 1.9
>         Environment: linux and windows, JRE 1.4.2_06 Lucene 1.9.1
>            Reporter: Erick Erickson
>         Assigned To: Michael Busch
>            Priority: Minor
>
> 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)
> From Erik Hatcher
> Feel free to log this as a bug report in our JIRA issue tracker.  It
> seems like a reasonable change to make, such that a WildcardQuery
> without a wildcard character would behave like TermQuery.

--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

[jira] Updated: (LUCENE-543) Wildcard query with no wildcard characters in the term throws StringIndexOutOfBounds exception

JIRA jira@apache.org
In reply to this post by JIRA jira@apache.org
     [ http://issues.apache.org/jira/browse/LUCENE-543?page=all ]

Michael Busch updated LUCENE-543:
---------------------------------

    Attachment: lucene543.patch

Overwrites rewrite() in WildcardQuery so that it returns a TermQuery if and only if the term does not contain a wildcard character. I also added a new test to TestWildcard that fails with the old version and passes with the patch.

All units tests pass and the patch compiles with a 1.4 JVM ;-)

> Wildcard query with no wildcard characters in the term throws StringIndexOutOfBounds exception
> ----------------------------------------------------------------------------------------------
>
>                 Key: LUCENE-543
>                 URL: http://issues.apache.org/jira/browse/LUCENE-543
>             Project: Lucene - Java
>          Issue Type: Improvement
>          Components: Search
>    Affects Versions: 1.9
>         Environment: linux and windows, JRE 1.4.2_06 Lucene 1.9.1
>            Reporter: Erick Erickson
>         Assigned To: Michael Busch
>            Priority: Minor
>         Attachments: lucene543.patch
>
>
> 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)
> From Erik Hatcher
> Feel free to log this as a bug report in our JIRA issue tracker.  It
> seems like a reasonable change to make, such that a WildcardQuery
> without a wildcard character would behave like TermQuery.

--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

[jira] Resolved: (LUCENE-543) Wildcard query with no wildcard characters in the term throws StringIndexOutOfBounds exception

JIRA jira@apache.org
In reply to this post by JIRA jira@apache.org
     [ http://issues.apache.org/jira/browse/LUCENE-543?page=all ]

Erik Hatcher resolved LUCENE-543.
---------------------------------

    Resolution: Fixed

Committed - thanks Michael!

> Wildcard query with no wildcard characters in the term throws StringIndexOutOfBounds exception
> ----------------------------------------------------------------------------------------------
>
>                 Key: LUCENE-543
>                 URL: http://issues.apache.org/jira/browse/LUCENE-543
>             Project: Lucene - Java
>          Issue Type: Improvement
>          Components: Search
>    Affects Versions: 1.9
>         Environment: linux and windows, JRE 1.4.2_06 Lucene 1.9.1
>            Reporter: Erick Erickson
>         Assigned To: Michael Busch
>            Priority: Minor
>         Attachments: lucene543.patch
>
>
> 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)
> From Erik Hatcher
> Feel free to log this as a bug report in our JIRA issue tracker.  It
> seems like a reasonable change to make, such that a WildcardQuery
> without a wildcard character would behave like TermQuery.

--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

[jira] Commented: (LUCENE-543) Wildcard query with no wildcard characters in the term throws StringIndexOutOfBounds exception

JIRA jira@apache.org
In reply to this post by JIRA jira@apache.org
    [ http://issues.apache.org/jira/browse/LUCENE-543?page=comments#action_12451494 ]
           
Michael Busch commented on LUCENE-543:
--------------------------------------

Wow that was quick, Erik!

> Wildcard query with no wildcard characters in the term throws StringIndexOutOfBounds exception
> ----------------------------------------------------------------------------------------------
>
>                 Key: LUCENE-543
>                 URL: http://issues.apache.org/jira/browse/LUCENE-543
>             Project: Lucene - Java
>          Issue Type: Improvement
>          Components: Search
>    Affects Versions: 1.9
>         Environment: linux and windows, JRE 1.4.2_06 Lucene 1.9.1
>            Reporter: Erick Erickson
>         Assigned To: Michael Busch
>            Priority: Minor
>         Attachments: lucene543.patch
>
>
> 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)
> From Erik Hatcher
> Feel free to log this as a bug report in our JIRA issue tracker.  It
> seems like a reasonable change to make, such that a WildcardQuery
> without a wildcard character would behave like TermQuery.

--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

[jira] Commented: (LUCENE-543) Wildcard query with no wildcard characters in the term throws StringIndexOutOfBounds exception

JIRA jira@apache.org
In reply to this post by JIRA jira@apache.org
    [ http://issues.apache.org/jira/browse/LUCENE-543?page=comments#action_12451496 ]
           
Erik Hatcher commented on LUCENE-543:
-------------------------------------

I owed you one!   And besides, I should have done this myself months ago when this was initially reported.

> Wildcard query with no wildcard characters in the term throws StringIndexOutOfBounds exception
> ----------------------------------------------------------------------------------------------
>
>                 Key: LUCENE-543
>                 URL: http://issues.apache.org/jira/browse/LUCENE-543
>             Project: Lucene - Java
>          Issue Type: Improvement
>          Components: Search
>    Affects Versions: 1.9
>         Environment: linux and windows, JRE 1.4.2_06 Lucene 1.9.1
>            Reporter: Erick Erickson
>         Assigned To: Michael Busch
>            Priority: Minor
>         Attachments: lucene543.patch
>
>
> 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)
> From Erik Hatcher
> Feel free to log this as a bug report in our JIRA issue tracker.  It
> seems like a reasonable change to make, such that a WildcardQuery
> without a wildcard character would behave like TermQuery.

--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]