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.

So, if no params are passed, the entire json file would get indexed to the _src_ field and all the values in the<br />

input JSON would go to a field named text. If there is a value for the uniqueKey it is stored and if no value<br />

could be obtained from the input JSON, a UUID is created and used as the uniqueKey field value.<br />

CSV Formatted Index Updates<br />

CSV formatted update requests may be sent to <strong>Solr</strong>'s /update handler using Content-Type:<br />

application/csv or Content-Type: text/csv.<br />

A sample CSV file is provided at example/exampledocs/books.csv that you can use to add some<br />

documents to the <strong>Solr</strong> techproducts example:<br />

curl 'http://localhost:8983/solr/techproducts/update?commit=true' --data-binary<br />

@example/exampledocs/books.csv -H 'Content-type:application/csv'<br />

CSV Update Parameters<br />

The CSV handler allows the specification of many parameters in the URL in the form: f. parameter.<br />

optional<br />

_fieldname= value .<br />

The table below describes the parameters for the update handler.<br />

Parameter Usage Global<br />

(g) or<br />

Per<br />

Field<br />

(f)<br />

separator Character used as field separator; default is "," g,(f:<br />

see<br />

split)<br />

Example<br />

separator=%09<br />

trim<br />

If true, remove leading and trailing whitespace<br />

from values. Default=false.<br />

g,f<br />

f.isbn.trim=true<br />

trim=false<br />

header<br />

Set to true if first line of input contains field<br />

names. These will be used if the fieldnames par<br />

ameter is absent.<br />

g<br />

fieldnames<br />

Comma separated list of field names to use<br />

when adding documents.<br />

g<br />

fieldnames=isbn,price,title<br />

literal. A literal value for a specified field name. g literal.color=red<br />

skip Comma separated list of field names to skip. g skip=uninteresting,shoesize<br />

skipLines<br />

Number of lines to discard in the input stream<br />

before the CSV data starts, including the header,<br />

if present. Default=0.<br />

g<br />

skipLines=5<br />

encapsulator<br />

The character optionally used to surround values<br />

to preserve characters such as the CSV<br />

separator or whitespace. This standard CSV<br />

format handles the encapsulator itself appearing<br />

in an encapsulated value by doubling the<br />

encapsulator.<br />

g,(f:<br />

see<br />

split)<br />

encapsulator="<br />

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

195

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

Saved successfully!

Ooh no, something went wrong!