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.

Data sent to <strong>Solr</strong> is not searchable until it has been committed to the index. The reason for this is that in some<br />

cases commits can be slow and they should be done in isolation from other possible commit requests to avoid<br />

overwriting data. So, it's preferable to provide control over when data is committed. Several options are available<br />

to control the timing of commits.<br />

commit and softCommit<br />

In <strong>Solr</strong>, a commit is an action which asks <strong>Solr</strong> to "commit" those changes to the Lucene index files. By default<br />

commit actions result in a "hard commit" of all the Lucene index files to stable storage (disk). When a client<br />

includes a commit=true parameter with an update request, this ensures that all index segments affected by the<br />

adds & deletes on an update are written to disk as soon as index updates are completed.<br />

If an additional flag softCommit=true is specified, then <strong>Solr</strong> performs a 'soft commit', meaning that <strong>Solr</strong> will<br />

commit your changes to the Lucene data structures quickly but not guarantee that the Lucene index files are<br />

written to stable storage. This is an implementation of Near Real Time storage, a feature that boosts document<br />

visibility, since you don't have to wait for background merges and storage (to ZooKeeper, if using <strong>Solr</strong>Cloud) to<br />

finish before moving on to something else. A full commit means that, if a server crashes, <strong>Solr</strong> will know exactly<br />

where your data was stored; a soft commit means that the data is stored, but the location information isn't yet<br />

stored. The tradeoff is that a soft commit gives you faster visibility because it's not waiting for background<br />

merges to finish.<br />

For more information about Near Real Time operations, see Near Real Time Searching.<br />

autoCommit<br />

These settings control how often pending updates will be automatically pushed to the index. An alternative to au<br />

toCommit is to use commitWithin, which can be defined when making the update request to <strong>Solr</strong> (i.e., when<br />

pushing documents), or in an update RequestHandler.<br />

Setting<br />

maxDocs<br />

maxTime<br />

Description<br />

The number of updates that have occurred since the last commit.<br />

The number of milliseconds since the oldest uncommitted update.<br />

openSearcher Whether to open a new searcher when performing a commit. If this is false, the default, the<br />

commit will flush recent index changes to stable storage, but does not cause a new searcher<br />

to be opened to make those changes visible<br />

If either of these maxDocs or maxTime limits are reached, <strong>Solr</strong> automatically performs a commit operation. If the<br />

autoCommit tag is missing, then only explicit commits will update the index. The decision whether to use<br />

auto-commit or not depends on the needs of your application.<br />

Determining the best auto-commit settings is a tradeoff between performance and accuracy. Settings that cause<br />

frequent updates will improve the accuracy of searches because new content will be searchable more quickly,<br />

but performance may suffer because of the frequent updates. Less frequent updates may improve performance<br />

but it will take longer for updates to show up in queries.<br />

<br />

10000<br />

1000<br />

false<br />

<br />

You can also specify 'soft' autoCommits in the same way that you can specify 'soft' commits, except that instead<br />

of using autoCommit you set the autoSoftCommit tag.<br />

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

450

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

Saved successfully!

Ooh no, something went wrong!