You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "Alexis Torres Paderewski (JIRA)" <ji...@apache.org> on 2013/05/29 11:49:20 UTC

[jira] [Comment Edited] (LUCENE-5021) NextDoc NPE safety when bulk collecting

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

Alexis Torres Paderewski edited comment on LUCENE-5021 at 5/29/13 9:48 AM:
---------------------------------------------------------------------------

Hello,

I am only interested in filtering using classical Solr PostFiltering the document that the user can't access. Main problem is that ACL call are dynamic depending on the documents, and I am buffering them in the PostFilter (DelegatingCollector part). The last call to nextDoc is not mine, but the BooleanScorer2 is calling it inside it's own for loop, then delegating to the sumScorer (DisjunctionSumScorer). In fact, I am exhausting the iterator myself in the PostFilter and BooleanScorer2 try to nextDoc after me. If DelegatingCollector would have an event on last doc, this wouldn't be need as I could simply use it.
                
      was (Author: alexistp):
    Hello,

I am only interested in filtering using classical Solr PostFiltering the document that the user can't access. Main problem is that ACL call are dynamic depending on the documents, and I am buffering them in the PostFilter (DelegatingCollector part). The last call to nextDoc is not mine, but the BooleanScorer2 is calling it inside it's own for loop, then delegaring to the sumScorer (DisjunctionSumScorer). In fact, I am exhausting the iterator myself in the PostFilter and BooleanScorer2 try to nextDoc after me. If DelegatingCollector would have an event on last doc, this wouldn't be need as I could simply use it.
                  
> NextDoc NPE safety when bulk collecting
> ---------------------------------------
>
>                 Key: LUCENE-5021
>                 URL: https://issues.apache.org/jira/browse/LUCENE-5021
>             Project: Lucene - Core
>          Issue Type: Improvement
>          Components: core/index, core/other
>    Affects Versions: 3.6.2
>         Environment: Any with custom filters
>            Reporter: Alexis Torres Paderewski
>              Labels: NPE,, Null-Safety, Scorer
>
> Hello,
> I would like to apply ACL once as a PostFilter and I therefore need to bulk this call since round trips would severely decrease performances.
> I tried to just stack them on the DelegatingCollector using this collect :
>     @Override
>     public void collect(int doc) throws IOException {
>         while ((doc = scorer.nextDoc()) != DocIdSetIterator.NO_MORE_DOCS) {
>             docs.put(getDocumentId(doc), doc);
>         }
>         batchCollect();
>     }
> Depending on the Scorer it may or it may not work. Indeed when the Scorer is "Safe"  that is when it handles 
> the case in which the scorer is exhausted and is called once again after exhaustion.
> This is the case of the (e.g. DisjunctionMaxScorer, ConstantScorer):
> if (numScorers == 0) return doc = NO_MORE_DOCS; 
> On the other hand, when using the DisjunctionSumScorer, it either asserts on "NO_MORE_DOCS", or it throws a NPE.
> Shouldn't we copy the DisjunctionMaxScorer mechanism to protect nextDoc of an exausted iterator using either current doc or checking numbers of subScorers ?

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org