[ 
http://issues.apache.org/jira/browse/LUCENE-504?page=comments#action_12415800 ] 

Doron Cohen commented on LUCENE-504:
------------------------------------

LuceneFAQ item    "Why am I getting a TooManyClauses exception?"   
suggests:    "use BooleanQuery.setMaxClauseCount(Integer.MAX_VALUE)". 

This would cause PriorityQueue to create an array of size maxint:
  - SUN JRE throws an out-of-memory error.
  - IBM JRE throws a "too large allocation" runtime error.

Seems that at least two fixes are required:
  + BooleanQuery - hard limit on value of maxClauseCount
  + PriorityQueue - hard limit on size of queue, since it is stored in memory.

The attached would set 1,000,000 hard limit - defined in PriorityQueu  - I 
think the most intensive use of
priority queue is for docs/hits during search, and 1M docs seems sufficient, 
unless there are uses that I am not aware of.


> FuzzyQuery produces a "java.lang.NegativeArraySizeException" in 
> PriorityQueue.initialize if I use Integer.MAX_VALUE as 
> BooleanQuery.MaxClauseCount
> --------------------------------------------------------------------------------------------------------------------------------------------------
>
>          Key: LUCENE-504
>          URL: http://issues.apache.org/jira/browse/LUCENE-504
>      Project: Lucene - Java
>         Type: Bug

>   Components: Search
>     Versions: 1.9
>     Reporter: Joerg Henss
>     Priority: Minor
>  Attachments: 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.
-
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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to