11.05.2016 Views

Apache Solr Reference Guide Covering Apache Solr 6.0

21SiXmO

21SiXmO

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

post-processors<br />

<br />

<br />

<br />

However executing a processor only on the forwarding nodes is a great way of distributing an expensive<br />

computation such as de-duplication across a <strong>Solr</strong>Cloud cluster by sending requests randomly via a load<br />

balancer. Otherwise the expensive computation is repeated on both the leader and replica nodes.<br />

Pre-processors and Atomic Updates<br />

Because DistributedUpdateProcessor is responsible for processing Atomic Updates into full documents<br />

on the leader node, this means that pre-processors which are executed only on the forwarding nodes<br />

can only operate on the partial document. If you have a processor which must process a full document<br />

then the only choice is to specify it as a post-processor.<br />

Using custom chains<br />

update.chain request parameter<br />

The update.chain parameter can be used in any update request to choose a custom chain which has been<br />

configured in solrconfig.xml. For example, in order to choose the "dedupe" chain described in a previous section,<br />

one can issue the following request:<br />

update.chain<br />

curl<br />

"http://localhost:8983/solr/gettingstarted/update/json?update.chain=dedupe&commit=tr<br />

ue" -H 'Content-type: application/json' -d '<br />

[<br />

{<br />

"name" : "The Lightning Thief",<br />

"features" : "This is just a test",<br />

"cat" : ["book","hardcover"]<br />

},<br />

{<br />

"name" : "The Lightning Thief",<br />

"features" : "This is just a test",<br />

"cat" : ["book","hardcover"]<br />

}<br />

]'<br />

The above should dedupe the two identical documents and index only one of them.<br />

processor & post-processor request parameters<br />

We can dynamically construct a custom update request processor chain using the "processor" and<br />

"post-processor" request parameters. Multiple processors can be specified as a comma-separated value for<br />

these two parameters. For example:<br />

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

462

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

Saved successfully!

Ooh no, something went wrong!