11.05.2016 Views

Apache Solr Reference Guide Covering Apache Solr 6.0

21SiXmO

21SiXmO

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

2.<br />

required between requests. The factory class must be thread-safe.<br />

Every update request processor chain is constructed during loading of a <strong>Solr</strong> core and cached until the core is<br />

unloaded. Each UpdateRequestProcessorFactory specified in the chain is also instantiated and initialized with<br />

configuration that may have been specified in solrconfig.xml.<br />

When an update request is received by <strong>Solr</strong>, it looks up the update chain to be used for this request. A new<br />

instance of each UpdateRequestProcessor specified in the chain is created using the corresponding factory. The<br />

update request is parsed into corresponding UpdateCommand objects which are run through the chain. Each<br />

UpdateRequestProcessor instance is responsible for invoking the next plugin in the chain. It can choose to short<br />

circuit the chain by not invoking the next processor and even abort further processing by throwing an exception.<br />

A single update request may contain a batch of multiple new documents or deletes and therefore the<br />

corresponding processXXX methods of an UpdateRequestProcessor will be invoked multiple times for<br />

every individual update. However, it is guaranteed that a single thread will serially invoke these methods.<br />

Configuration<br />

Update request processors chains can be created by either creating the whole chain directly in solrconfig.xml or<br />

by creating individual update processors in solrconfig.xml and then dynamically creating the chain at run-time by<br />

specifying all processors via request parameters.<br />

However, before we understand how to configure update processor chains, we must learn about the default<br />

update processor chain because it provides essential features which are needed in most custom request<br />

processor chains as well.<br />

The default update request processor chain<br />

In case no update processor chains are configured in solrconfig.xml, <strong>Solr</strong> will automatically create a default<br />

update processor chain which will be used for all update requests. This default update processor chain consists<br />

of the following processors (in order):<br />

1.<br />

2.<br />

3.<br />

LogUpdateProcessorFactory - Tracks the commands processed during this request and logs them<br />

DistributedUpdateProcessorFactory - Responsible for distributing update requests to the right node e.g.<br />

routing requests to the leader of the right shard and distributing updates from the leader to each replica. T<br />

his processor is activated only in <strong>Solr</strong>Cloud mode.<br />

RunUpdateProcessorFactory - Executes the update using internal <strong>Solr</strong> APIs.<br />

Each of these perform an essential function and as such any custom chain usually contain all of these<br />

processors. The RunUpdateProcessorFactory is usually the last update processor in any custom chain.<br />

Custom update request processor chain<br />

The following example demonstrates how a custom chain can be configured inside solrconfig.xml.<br />

<strong>Apache</strong> <strong>Solr</strong> <strong>Reference</strong> <strong>Guide</strong> <strong>6.0</strong><br />

459

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!