I implemented the security post filtering (using Solr 4.3.1) as proposed here (and it works fine) using a PostFilter
:
http://searchhub.org/2012/02/22/custom-security-filtering-in-solr/
The comment of the PostFilter interface says:
This collector interface also enables better performance when an external system must be consulted, since document ids may be buffered and batched into a single request to the external system.
This is exactly what I want to do.
The plan how to realize this based on the implementation linked above is clear:
Do not call super.collect(int)
in collect(int)
of the anonymous class returned by getFilterCollector(IndexSearcher)
, but memorize the doc IDs and instead. As soon as all docs have been collected (i.e. collect(int)
has been called on all docs), make the batch request to the external ACL system and call super.collect(doc)
only for those docs that passed the security check.
But how can I know that a certain call of DelegatingCollector.collect(int)
was the last one for the current query?
I can’t find any method, neither in PostFilter
, DelegatingCollector
nor ExtendedQuery
, which is called at the end of the collection process.
Can anybody tell me which method I'm missing or how this batch processing can be achieved at all?
Thanks in advance, Simon
A friendly support employee at LucidWorks was so kind to point me to the right Solr issue: https://issues.apache.org/jira/browse/SOLR-5020
As I used Solr 4.3.1 and Solr 4.5 is not released yet, I couldn't find the solution in the code.