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.

Documents, Fields, and Schema Design<br />

This section discusses how <strong>Solr</strong> organizes its data into documents and fields, as well as how to work with a<br />

schema in <strong>Solr</strong>.<br />

This section includes the following topics:<br />

Overview of Documents, Fields, and Schema Design: An introduction to the concepts covered in this section.<br />

<strong>Solr</strong> Field Types: Detailed information about field types in <strong>Solr</strong>, including the field types in the default <strong>Solr</strong><br />

schema.<br />

Defining Fields: Describes how to define fields in <strong>Solr</strong>.<br />

Copying Fields: Describes how to populate fields with data copied from another field.<br />

Dynamic Fields: Information about using dynamic fields in order to catch and index fields that do not exactly<br />

conform to other field definitions in your schema.<br />

Schema API: Use curl commands to read various parts of a schema or create new fields and copyField rules.<br />

Other Schema Elements: Describes other important elements in the <strong>Solr</strong> schema.<br />

Putting the Pieces Together: A higher-level view of the <strong>Solr</strong> schema and how its elements work together.<br />

DocValues: Describes how to create a docValues index for faster lookups.<br />

Schemaless Mode: Automatically add previously unknown schema fields using value-based field type guessing.<br />

Overview of Documents, Fields, and Schema Design<br />

The fundamental premise of <strong>Solr</strong> is simple. You give it a lot of information, then later you can ask it questions<br />

and find the piece of information you want. The part where you feed in all the information is called indexing or up<br />

dating. When you ask a question, it's called a query.<br />

One way to understand how <strong>Solr</strong> works is to think of a loose-leaf book of recipes. Every time you add a recipe to<br />

the book, you update the index at the back. You list each ingredient and the page number of the recipe you just<br />

added. Suppose you add one hundred recipes. Using the index, you can very quickly find all the recipes that use<br />

garbanzo beans, or artichokes, or coffee, as an ingredient. Using the index is much faster than looking through<br />

each recipe one by one. Imagine a book of one thousand recipes, or one million.<br />

<strong>Solr</strong> allows you to build an index with many different fields, or types of entries. The example above shows how to<br />

build an index with just one field, ingredients. You could have other fields in the index for the recipe's cooking<br />

style, like Asian, Cajun, or vegan, and you could have an index field for preparation times. <strong>Solr</strong> can answer<br />

questions like "What Cajun-style recipes that have blood oranges as an ingredient can be prepared in fewer than<br />

30 minutes?"<br />

The schema is the place where you tell <strong>Solr</strong> how it should build indexes from input documents.<br />

How <strong>Solr</strong> Sees the World<br />

<strong>Solr</strong>'s basic unit of information is a document, which is a set of data that describes something. A recipe document<br />

would contain the ingredients, the instructions, the preparation time, the cooking time, the tools needed, and so<br />

on. A document about a person, for example, might contain the person's name, biography, favorite color, and<br />

shoe size. A document about a book could contain the title, author, year of publication, number of pages, and so<br />

on.<br />

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

48

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

Saved successfully!

Ooh no, something went wrong!