Solr: How to perform a batch request to an external system from a PostFilter?

微笑、不失礼 提交于 2019-12-11 18:15:38

问题


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


回答1:


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.



来源:https://stackoverflow.com/questions/18175689/solr-how-to-perform-a-batch-request-to-an-external-system-from-a-postfilter

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!