[ 
https://issues.apache.org/jira/browse/LUCENE-504?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12773402#action_12773402
 ] 

Nadav Har'El commented on LUCENE-504:
-------------------------------------

Hi Uwe, I think that even though PriorityQueue doesn't have a size limit, it is 
easy to implement a size limit: after an add(), if size() becomes greater than 
the bound, you simply poll() to remove the lowest element (this poll() returns 
the old object which insertWithOverflow() is to return).

However, I think it's a good idea to compare the performance of Java's 
PriorityQueue (used as in the paragraph above) . I'm especially worried about 
the slowdown by the fact that adding a small element (below the current heap's 
head) in our code just does one comparison and returns, but in the usage I 
described above it actually modifies the heap twice (adds the element to the 
heap and then removes it).

> 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, 
> 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-unsubscr...@lucene.apache.org
For additional commands, e-mail: java-dev-h...@lucene.apache.org

Reply via email to