11.05.2016 Views

Apache Solr Reference Guide Covering Apache Solr 6.0

21SiXmO

21SiXmO

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

elow is legacy and was used prior to the existence of <strong>Solr</strong>Cloud. <strong>Solr</strong>Cloud provides for a truly distributed set of<br />

features with support for things like automatic routing, leader election, optimistic concurrency and other sanity<br />

checks that are expected out of a distributed system.<br />

Everything on this page is specific to legacy setup of distributed search. Users trying out <strong>Solr</strong>Cloud should not<br />

follow any of the steps or information below.<br />

Update reorders (i.e., replica A may see update X then Y, and replica B may see update Y then X). deleteByQu<br />

ery also handles reorders the same way, to ensure replicas are consistent. All replicas of a shard are consistent,<br />

even if the updates arrive in a different order on different replicas.<br />

Distributing Documents across Shards<br />

When not using <strong>Solr</strong>Cloud, it is up to you to get all your documents indexed on each shard of your server farm.<br />

<strong>Solr</strong> supports distributed indexing (routing) in it's true form only in the <strong>Solr</strong>Cloud mode.<br />

In the legacy distributed mode, <strong>Solr</strong> does not calculate universal term/doc frequencies. For most large-scale<br />

implementations, it is not likely to matter that <strong>Solr</strong> calculates TF/IDF at the shard level. However, if your collection<br />

is heavily skewed in its distribution across servers, you may find misleading relevancy results in your searches.<br />

In general, it is probably best to randomly distribute documents to your shards.<br />

Executing Distributed Searches with the shards Parameter<br />

If a query request includes the shards parameter, the <strong>Solr</strong> server distributes the request across all the shards<br />

listed as arguments to the parameter. The shards parameter uses this syntax:<br />

host<br />

: port / base_url [, host : port / base_url ]*<br />

For example, the shards parameter below causes the search to be distributed across two <strong>Solr</strong> servers: solr1 an<br />

d solr2, both of which are running on port 8983:<br />

http://localhost:8983/solr/core1/select?shards=solr1:8983/solr/core1,solr2:8983/so<br />

lr/core1&indent=true&q=ipod+solr<br />

Rather than require users to include the shards parameter explicitly, it is usually preferred to configure this<br />

parameter as a default in the RequestHandler section of solrconfig.xml.<br />

Do not add the shards parameter to the standard requestHandler; otherwise, search queries may enter<br />

an infinite loop. Instead, define a new requestHandler that uses the shards parameter, and pass<br />

distributed search requests to that handler.<br />

Currently, only query requests are distributed. This includes requests to the standard request handler (and<br />

subclasses such as the DisMax RequestHandler), and any other handler (org.apache.solr.handler.comp<br />

onent.searchHandler) using standard components that support distributed search.<br />

As in <strong>Solr</strong>Cloud mode, when shards.info=true, distributed responses will include information about the<br />

shard (where each shard represents a logically different index or physical location)<br />

The following components support distributed search:<br />

The Query component, which returns documents matching a query<br />

The Facet component, which processes facet.query and facet.field requests where facets are sorted by<br />

count (the default).<br />

The Highlighting component, which enables <strong>Solr</strong> to include "highlighted" matches in field values.<br />

The Stats component, which returns simple statistics for numeric fields within the DocSet.<br />

The Debug component, which helps with debugging.<br />

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

626

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

Saved successfully!

Ooh no, something went wrong!