Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Lucene: Java-Dev

[jira] Updated: (LUCENE-504) FuzzyQuery produces a "java.lang.NegativeArraySizeException" in PriorityQueue.initialize if I use Integer.MAX_VALUE as BooleanQuery.MaxClauseCount

 

 

Lucene java-dev RSS feed   Index | Next | Previous | View Threaded


jira at apache

Nov 4, 2009, 9:11 AM

Post #1 of 2 (44 views)
Permalink
[jira] Updated: (LUCENE-504) FuzzyQuery produces a "java.lang.NegativeArraySizeException" in PriorityQueue.initialize if I use Integer.MAX_VALUE as BooleanQuery.MaxClauseCount

[ https://issues.apache.org/jira/browse/LUCENE-504?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Uwe Schindler updated LUCENE-504:
---------------------------------

Attachment: LUCENE-504.patch

Here is a patch for this issue, using j.u.PriorityQueue. It currently does not limit the PQ's number of entries, it just only consumes maxClauseCount ones.

All tests pass, but they are no real test of the PQ behaviour, as the current test cases do not test more terms than maxClauseCount. So the tests pass in all cases, independent how the compareTo method looks like, so the ordering is not important because the queue never gets full. I will add a test.

I will also try to implement the max size, but for now, the patch shows, how the code could look like with j.u.PQ.

> FuzzyQuery produces a "java.lang.NegativeArraySizeException" in PriorityQueue.initialize if I use Integer.MAX_VALUE as BooleanQuery.MaxClauseCount
> --------------------------------------------------------------------------------------------------------------------------------------------------
>
> Key: LUCENE-504
> URL: https://issues.apache.org/jira/browse/LUCENE-504
> Project: Lucene - Java
> Issue Type: Bug
> Components: Search
> Affects Versions: 1.9
> Reporter: Joerg Henss
> Priority: Minor
> Attachments: BooleanQuery.java.diff, fuzzyquery.patch, LUCENE-504.patch, PriorityQueue.java.diff, TestFuzzyQueryError.java
>
>
> PriorityQueue creates an "java.lang.NegativeArraySizeException" when initialized with Integer.MAX_VALUE, because Integer overflows. I think this could be a general problem with PriorityQueue. The Error occured when I set BooleanQuery.MaxClauseCount to Integer.MAX_VALUE and user a FuzzyQuery for searching.

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe[at]lucene.apache.org
For additional commands, e-mail: java-dev-help[at]lucene.apache.org


jira at apache

Nov 4, 2009, 1:49 PM

Post #2 of 2 (37 views)
Permalink
[jira] Updated: (LUCENE-504) FuzzyQuery produces a "java.lang.NegativeArraySizeException" in PriorityQueue.initialize if I use Integer.MAX_VALUE as BooleanQuery.MaxClauseCount [In reply to]

[ https://issues.apache.org/jira/browse/LUCENE-504?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Uwe Schindler updated LUCENE-504:
---------------------------------

Attachment: LUCENE-504.patch

Here a patch, that fixes FuzzyQuery. It uses j.u.PQ and has a small optimization to not add ScoreTerms, that would never be seen in the first maxClauseCount terms (tracking a bottom value).

It also adds an testcase, where the maxClauseCount is lowerd downto 2 and the FuzzyQuery would hit 3 terms, so one too much. This tests the algorithm to not add this entry to the PQ.

Nadav: The solution you propsed for limiting the number of entries in the PQ does not work, as poll() removes the head element of the queue, not the bottom that falls out. There is no way to remove the bottom value in Java's PQ easily. So we should j.u.PQ only for this issue.

> FuzzyQuery produces a "java.lang.NegativeArraySizeException" in PriorityQueue.initialize if I use Integer.MAX_VALUE as BooleanQuery.MaxClauseCount
> --------------------------------------------------------------------------------------------------------------------------------------------------
>
> Key: LUCENE-504
> URL: https://issues.apache.org/jira/browse/LUCENE-504
> Project: Lucene - Java
> Issue Type: Bug
> Components: Search
> Affects Versions: 1.9
> Reporter: Joerg Henss
> Priority: Minor
> Attachments: BooleanQuery.java.diff, fuzzyquery.patch, LUCENE-504.patch, LUCENE-504.patch, PriorityQueue.java.diff, TestFuzzyQueryError.java
>
>
> PriorityQueue creates an "java.lang.NegativeArraySizeException" when initialized with Integer.MAX_VALUE, because Integer overflows. I think this could be a general problem with PriorityQueue. The Error occured when I set BooleanQuery.MaxClauseCount to Integer.MAX_VALUE and user a FuzzyQuery for searching.

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe[at]lucene.apache.org
For additional commands, e-mail: java-dev-help[at]lucene.apache.org

Lucene java-dev RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact lists@gossamer-threads.com
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.