-1

我必须在我的应用程序中使用 BinaryResponseParser。我不知道 BinaryResponseParser 的用途。当我在网上搜索时,我得到了一条信息“发送回调事件而不是构建大响应的 BinaryResponseParser

这里什么是响应中的回调事件。任何人都可以清楚地解释什么是回调事件以及它是如何在 Solr 中使用的。

如果在我的应用程序中没有使用 BinaryResponseParser 方法,会有什么影响?

4

1 回答 1

3

BinaryResponseParser is a parser for Solr responses serialized in a binary format as opposed to json or xml. The class has one method that can be of use to you (v. 3.6.x):

public NamedList<Object> processResponse(InputStream body, String encoding).

The advantage of using binary serialization is that your response size will be much smaller. This can be critical for the performance of live IR systems like Lucene/Solr - just imagine an auto-suggest service, which has to provide a list of suggestions for a user for every key-stroke. The response must be dellivered to the user bellow 100ms. If you don't use binary encoding, your response will be larger and consequently will take a bit longer to transfer over HTTP.

I suggest you take a look at SolrJ - a Java client for Solr that will possibly solve most of your problems.

于 2013-01-23T12:49:34.577 回答