Solr:如何从PostFilter执行对外部系统的批处理请求? [英] Solr: How to perform a batch request to an external system from a PostFilter?
问题描述
我使用PostFilter
实施了此处建议的安全后过滤(使用Solr 4.3.1)(工作正常):
http://searchhub.org/2012/02/22/custom-security-filtering-in-solr/
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/
当必须咨询外部系统时,此收集器接口还可以提供更好的性能,因为文档ID可能会被缓冲并成批发送到对外部系统的单个请求中.
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.
这正是我想要做的.
基于上面链接的实现,如何实现这一目标的计划很明确:
不要在getFilterCollector(IndexSearcher)
返回的匿名类的collect(int)
中调用super.collect(int)
,而是记住存储文档ID.收集完所有文档后(即在所有文档上都调用了collect(int)
),请向外部ACL系统发出批处理请求,并仅对通过安全检查的那些文档调用super.collect(doc)
.
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.
但是我怎么知道DelegatingCollector.collect(int)
的某个调用是当前查询的最后一个?
在收集过程结束时调用的PostFilter
,DelegatingCollector
和ExtendedQuery
中都找不到任何方法.
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?
预先感谢, 西蒙
推荐答案
LucidWorks 上一位友好的支持员工是如此为我指出正确的Solr问题: https://issues.apache.org/jira/browse/SOLR-5020
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
当我使用Solr 4.3.1且尚未发布Solr 4.5时,我无法在代码中找到解决方案.
As I used Solr 4.3.1 and Solr 4.5 is not released yet, I couldn't find the solution in the code.
这篇关于Solr:如何从PostFilter执行对外部系统的批处理请求?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!