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.

The replace-field-type command replaces a field type in your schema. Note that you must supply the full<br />

definition for a field type - this command will not partially modify a field type's definition. If the field type does not<br />

exist in the schema an error is thrown.<br />

All of the field type properties available when editing schema.xml by hand are available for use in a POST<br />

request. The structure of the command is a json mapping of the standard field type definition, including the<br />

name, class, index and query analyzer definitions, etc. Details of all of the available options are described in the<br />

section <strong>Solr</strong> Field Types.<br />

For example, to replace the definition of a field type named "myNewTxtField", you can make a POST request as<br />

follows:<br />

curl -X POST -H 'Content-type:application/json' --data-binary '{<br />

"replace-field-type":{<br />

"name":"myNewTxtField",<br />

"class":"solr.TextField",<br />

"positionIncrementGap":"100",<br />

"analyzer":{<br />

"tokenizer":{<br />

"class":"solr.StandardTokenizerFactory" }}}<br />

}' http://localhost:8983/solr/gettingstarted/schema<br />

Add a New Copy Field Rule<br />

The add-copy-field command adds a new copy field rule to your schema.<br />

The attributes supported by the command are the same as when creating copy field rules by manually editing<br />

the schema.xml, as below:<br />

Name Required Description<br />

source Yes The source field.<br />

dest Yes A field or an array of fields to which the source field will be copied.<br />

maxChars No The upper limit for the number of characters to be copied. The section Copying Fields<br />

has more details.<br />

For example, to define a rule to copy the field "shelf" to the "location" and "catchall" fields, you would POST the<br />

following request:<br />

curl -X POST -H 'Content-type:application/json' --data-binary '{<br />

"add-copy-field":{<br />

"source":"shelf",<br />

"dest":[ "location", "catchall" ]}<br />

}' http://localhost:8983/solr/gettingstarted/schema<br />

Delete a Copy Field Rule<br />

The delete-copy-field command deletes a copy field rule from your schema. If the copy field rule does not<br />

exist in the schema an error is thrown.<br />

The source and dest attributes are required by this command.<br />

For example, to delete a rule to copy the field "shelf" to the "location" field, you would POST the following<br />

request:<br />

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

77

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

Saved successfully!

Ooh no, something went wrong!