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.

Retrieving DocValues During Search<br />

Field values retrieved during search queries are typically returned from stored values. However, non-stored<br />

docValues fields will be also returned along with other stored fields when all fields (or pattern matching globs) are<br />

specified to be returned (e.g. " fl=* ") for search queries depending on the effective value of the useDocValues<br />

AsStored parameter for each field. For schema versions >= 1.6, the implicit default is useDocValuesAsStor<br />

ed="true" . See Field Type Definitions and Properties & Defining Fields for more details.<br />

When useDocValuesAsStored="false" , non-stored DocValues fields can still be explicitly requested by<br />

name in the fl param , but will not match glob patterns ("*").<br />

Note that returning DocValues along with "regular" stored fields at query time has performance implications that<br />

stored fields may not because DocValues are column-oriented and may therefore incur additional cost to retrieve<br />

for each returned document. Also note that while returning non-stored fields from DocValues, the values of a<br />

multi-valued field are returned in sorted order (and not insertion order). If you require the multi-valued fields to be<br />

returned in the original insertion order, then make your multi-valued field as stored (such a change requires<br />

re-indexing).<br />

In cases where the query is returning only docValues fields performance may improve since returning stored<br />

fields requires disk reads and decompression whereas returning docValues fields in the fl list only requires<br />

memory access.<br />

When retrieving fields from their docValues form, two important differences between regular stored fields and<br />

docValues fields must be understood:<br />

1. Order is not preserved. For simply retrieving stored fields, the insertion order is the return order. For<br />

docValues, it is the sorted order.<br />

2. Multiple identical entries are collapsed into a single value. Thus if I insert values 4, 5, 2, 4, 1, my return will<br />

be 1, 2, 4, 5.<br />

Schemaless Mode<br />

Schemaless Mode is a set of <strong>Solr</strong> features that, when used together, allow users to rapidly construct an effective<br />

schema by simply indexing sample data, without having to manually edit the schema. These <strong>Solr</strong> features, all<br />

controlled via solrconfig.xml, are:<br />

1. Managed schema: Schema modifications are made at runtime through <strong>Solr</strong> APIs, which requires the use<br />

of schemaFactory that supports these changes - see Schema Factory Definition in <strong>Solr</strong>Config for more<br />

details.<br />

2. Field value class guessing: Previously unseen fields are run through a cascading set of value-based<br />

parsers, which guess the Java class of field values - parsers for Boolean, Integer, Long, Float, Double,<br />

and Date are currently available.<br />

3. Automatic schema field addition, based on field value class(es): Previously unseen fields are added to the<br />

schema, based on field value Java classes, which are mapped to schema field types - see <strong>Solr</strong> Field<br />

Types.<br />

Using the Schemaless Example<br />

The three features of schemaless mode are pre-configured in the data_driven_schema_configs config set i<br />

n the <strong>Solr</strong> distribution. To start an example instance of <strong>Solr</strong> using these configs, run the following command:<br />

bin/solr start -e schemaless<br />

This will launch a <strong>Solr</strong> server, and automatically create a collection (named " gettingstarted")<br />

that contains<br />

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

97

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

Saved successfully!

Ooh no, something went wrong!