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.

XML Update Commands<br />

Commit and Optimize Operations<br />

The operation writes all documents loaded since the last commit to one or more segment files on the<br />

disk. Before a commit has been issued, newly indexed content is not visible to searches. The commit operation<br />

opens a new searcher, and triggers any event listeners that have been configured.<br />

Commits may be issued explicitly with a message, and can also be triggered from <br />

parameters in solrconfig.xml.<br />

The operation requests <strong>Solr</strong> to merge internal data structures in order to improve search<br />

performance. For a large index, optimization will take some time to complete, but by merging many small<br />

segment files into a larger one, search performance will improve. If you are using <strong>Solr</strong>'s replication mechanism to<br />

distribute searches across many systems, be aware that after an optimize, a complete index will need to be<br />

transferred. In contrast, post-commit transfers are usually much smaller.<br />

The and elements accept these optional attributes:<br />

Optional<br />

Attribute<br />

waitSearcher<br />

expungeDeletes<br />

maxSegments<br />

Description<br />

Default is true. Blocks until a new searcher is opened and registered as the main query<br />

searcher, making the changes visible.<br />

(commit only) Default is false. Merges segments that have more than 10% deleted docs,<br />

expunging them in the process.<br />

(optimize only) Default is 1. Merges the segments down to no more than this number of<br />

segments.<br />

Here are examples of and using optional attributes:<br />

<br />

<br />

<br />

Delete Operations<br />

Documents can be deleted from the index in two ways. "Delete by ID" deletes the document with the specified<br />

ID, and can be used only if a UniqueID field has been defined in the schema. "Delete by Query" deletes all<br />

documents matching a specified query, although commitWithin is ignored for a Delete by Query. A single<br />

delete message can contain multiple delete operations.<br />

<br />

0002166313<br />

0031745983<br />

subject:sport<br />

publisher:penguin<br />

<br />

When using the Join query parser in a Delete By Query, you should use the score parameter with a<br />

value of " none" to avoid a ClassCastException. See the section on the Join Query Parser for more<br />

details on the score parameter.<br />

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

185

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

Saved successfully!

Ooh no, something went wrong!