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.

Constructing a chain at request time<br />

# Executing processors configured in solrconfig.xml as (pre)-processors<br />

curl<br />

"http://localhost:8983/solr/gettingstarted/update/json?processor=remove_blanks,signa<br />

ture&commit=true" -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 />

# Executing processors configured in solrconfig.xml as pre and post processors<br />

curl<br />

"http://localhost:8983/solr/gettingstarted/update/json?processor=remove_blanks&postprocessor=signature&commit=true"<br />

-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 />

In the first example, <strong>Solr</strong> will dynamically create a chain which has "signature" and "remove_blanks" as<br />

pre-processors to be executed only on the forwarding node where as in the second example, "remove_blanks"<br />

will be executed as a pre-processor and "signature" will be executed on the leader and replicas as a post<br />

processor.<br />

Configuring a custom chain as a default<br />

We can also specify a custom chain to be used by default for all requests sent to specific update handlers<br />

instead of specifying the names in request parameters for each request.<br />

This can be done by adding either "update.chain" or "processor" and "post-processor" as default parameter for a<br />

given path which can be done either via InitParams in <strong>Solr</strong>Config or by adding them in a "defaults" section which<br />

is supported by all request handlers.<br />

The following is an actual InitParam defined in the schemaless configuration which applies a custom update<br />

chain to all request handlers starting with "/update/".<br />

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

463

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

Saved successfully!

Ooh no, something went wrong!