You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "Michael McCandless (JIRA)" <ji...@apache.org> on 2010/11/30 10:33:10 UTC

[jira] Created: (LUCENE-2785) TopFieldCollector throws AIOOBE if numHits is 0

TopFieldCollector throws AIOOBE if numHits is 0
-----------------------------------------------

                 Key: LUCENE-2785
                 URL: https://issues.apache.org/jira/browse/LUCENE-2785
             Project: Lucene - Java
          Issue Type: Bug
          Components: Search
            Reporter: Michael McCandless
            Priority: Minor
             Fix For: 3.1, 4.0


See solr-user thread "ArrayIndexOutOfBoundsException for query with rows=0 and sort param".

I think we should just create a null collector (only tallies up totalHits) if numHits is 0?

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


[jira] Resolved: (LUCENE-2785) TopFieldCollector throws AIOOBE if numHits is 0

Posted by "Michael McCandless (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/LUCENE-2785?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Michael McCandless resolved LUCENE-2785.
----------------------------------------

    Resolution: Fixed

> TopFieldCollector throws AIOOBE if numHits is 0
> -----------------------------------------------
>
>                 Key: LUCENE-2785
>                 URL: https://issues.apache.org/jira/browse/LUCENE-2785
>             Project: Lucene - Java
>          Issue Type: Bug
>          Components: Search
>            Reporter: Michael McCandless
>            Priority: Minor
>             Fix For: 3.1, 4.0
>
>         Attachments: LUCENE-2785.patch
>
>
> See solr-user thread "ArrayIndexOutOfBoundsException for query with rows=0 and sort param".
> I think we should just create a null collector (only tallies up totalHits) if numHits is 0?

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


[jira] Commented: (LUCENE-2785) TopFieldCollector throws AIOOBE if numHits is 0

Posted by "Michael McCandless (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENE-2785?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12965188#action_12965188 ] 

Michael McCandless commented on LUCENE-2785:
--------------------------------------------

So... IndexSearcher.search (the one that sorts by score) throws an EXC if numHits is 0...

Maybe... we should do the same for the sort-by-field case?

And, also make this new Collector that only counts hits?  The exception message can then point users to this new Collector?

I'm all for not making the app handle corner cases... but, then, I don't like that you silently get bad performance.  It's better to steer the apps to use the right Collector for the job?

> TopFieldCollector throws AIOOBE if numHits is 0
> -----------------------------------------------
>
>                 Key: LUCENE-2785
>                 URL: https://issues.apache.org/jira/browse/LUCENE-2785
>             Project: Lucene - Java
>          Issue Type: Bug
>          Components: Search
>            Reporter: Michael McCandless
>            Priority: Minor
>             Fix For: 3.1, 4.0
>
>
> See solr-user thread "ArrayIndexOutOfBoundsException for query with rows=0 and sort param".
> I think we should just create a null collector (only tallies up totalHits) if numHits is 0?

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


[jira] Commented: (LUCENE-2785) TopFieldCollector throws AIOOBE if numHits is 0

Posted by "Uwe Schindler (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENE-2785?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12965192#action_12965192 ] 

Uwe Schindler commented on LUCENE-2785:
---------------------------------------

bq. So... IndexSearcher.search (the one that sorts by score) throws an EXC if numHits is 0... Maybe... we should do the same for the sort-by-field case?

I think IndexSearcher should not only throw the exception, in my opinion the create() method in TSDC and TFDC should also check this and throw the exception? A lot of people, also solr are instantiating the collectors themselves (although not recommeneded, because they dont know the correct booleans passed in).

+1 for TSDC and TFDC throw exception if hitcount <1

bq. And, also make this new Collector that only counts hits? The exception message can then point users to this new Collector?

+1 to the new collector that simply counts. I have such a collector also sometimes in my code. Misusing TFDC or TSDC is wrong and uses too much resources.

> TopFieldCollector throws AIOOBE if numHits is 0
> -----------------------------------------------
>
>                 Key: LUCENE-2785
>                 URL: https://issues.apache.org/jira/browse/LUCENE-2785
>             Project: Lucene - Java
>          Issue Type: Bug
>          Components: Search
>            Reporter: Michael McCandless
>            Priority: Minor
>             Fix For: 3.1, 4.0
>
>
> See solr-user thread "ArrayIndexOutOfBoundsException for query with rows=0 and sort param".
> I think we should just create a null collector (only tallies up totalHits) if numHits is 0?

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


[jira] Updated: (LUCENE-2785) TopFieldCollector throws AIOOBE if numHits is 0

Posted by "Michael McCandless (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/LUCENE-2785?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Michael McCandless updated LUCENE-2785:
---------------------------------------

    Attachment: LUCENE-2785.patch

Patch.

I moved the numHits > 0 check down into TFC.create an TSDC.create, out of IndexSearcher.

And I added a new TotalHitCountCollector.

> TopFieldCollector throws AIOOBE if numHits is 0
> -----------------------------------------------
>
>                 Key: LUCENE-2785
>                 URL: https://issues.apache.org/jira/browse/LUCENE-2785
>             Project: Lucene - Java
>          Issue Type: Bug
>          Components: Search
>            Reporter: Michael McCandless
>            Priority: Minor
>             Fix For: 3.1, 4.0
>
>         Attachments: LUCENE-2785.patch
>
>
> See solr-user thread "ArrayIndexOutOfBoundsException for query with rows=0 and sort param".
> I think we should just create a null collector (only tallies up totalHits) if numHits is 0?

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


[jira] Commented: (LUCENE-2785) TopFieldCollector throws AIOOBE if numHits is 0

Posted by "Uwe Schindler (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENE-2785?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12965172#action_12965172 ] 

Uwe Schindler commented on LUCENE-2785:
---------------------------------------

+1, I needed the same. Its often a use case to simply get number of results. And a PQ with one entry and all the logic does not make sense here. We should just count hits.

> TopFieldCollector throws AIOOBE if numHits is 0
> -----------------------------------------------
>
>                 Key: LUCENE-2785
>                 URL: https://issues.apache.org/jira/browse/LUCENE-2785
>             Project: Lucene - Java
>          Issue Type: Bug
>          Components: Search
>            Reporter: Michael McCandless
>            Priority: Minor
>             Fix For: 3.1, 4.0
>
>
> See solr-user thread "ArrayIndexOutOfBoundsException for query with rows=0 and sort param".
> I think we should just create a null collector (only tallies up totalHits) if numHits is 0?

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


[jira] Commented: (LUCENE-2785) TopFieldCollector throws AIOOBE if numHits is 0

Posted by "Earwin Burrfoot (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENE-2785?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12965202#action_12965202 ] 

Earwin Burrfoot commented on LUCENE-2785:
-----------------------------------------

"A Collector, that counts" - priceless.
And, yes, I have one of these too.

> TopFieldCollector throws AIOOBE if numHits is 0
> -----------------------------------------------
>
>                 Key: LUCENE-2785
>                 URL: https://issues.apache.org/jira/browse/LUCENE-2785
>             Project: Lucene - Java
>          Issue Type: Bug
>          Components: Search
>            Reporter: Michael McCandless
>            Priority: Minor
>             Fix For: 3.1, 4.0
>
>
> See solr-user thread "ArrayIndexOutOfBoundsException for query with rows=0 and sort param".
> I think we should just create a null collector (only tallies up totalHits) if numHits is 0?

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


[jira] Commented: (LUCENE-2785) TopFieldCollector throws AIOOBE if numHits is 0

Posted by "Shai Erera (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENE-2785?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12965180#action_12965180 ] 

Shai Erera commented on LUCENE-2785:
------------------------------------

It would be good if we could have a TotalHitsCollector which just counts total hits (as a standalone Collector). Problem is, we need to return a TDC from the static create() of TFC and TSDC, and a TotalHitsCollector shouldn't have topDocs() ... 

> TopFieldCollector throws AIOOBE if numHits is 0
> -----------------------------------------------
>
>                 Key: LUCENE-2785
>                 URL: https://issues.apache.org/jira/browse/LUCENE-2785
>             Project: Lucene - Java
>          Issue Type: Bug
>          Components: Search
>            Reporter: Michael McCandless
>            Priority: Minor
>             Fix For: 3.1, 4.0
>
>
> See solr-user thread "ArrayIndexOutOfBoundsException for query with rows=0 and sort param".
> I think we should just create a null collector (only tallies up totalHits) if numHits is 0?

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