Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the _root_ field in schema.xml?

Tags:

solr

I am reading solr example schema.xml. And I found a field named _root_. I have never seen it before. I don't know what it does.

<!-- points to the root document of a block of nested documents. Required for nested document support, may be removed otherwise -->
<field name="_root_" type="string" indexed="true" stored="false"/>

Is it a new feature of solr? What are the nested documents? And for what situation I should use this field?

My solr version is 4.6.

Thanks in advance.

like image 989
Cao Dongping Avatar asked Jan 04 '14 04:01

Cao Dongping


People also ask

Which information is specified in field type?

A field type defines the analysis that will occur on a field when documents are indexed or queries are sent to the index. A field type definition can include four types of information: The name of the field type (mandatory). An implementation class name (mandatory).

What is field in SOLR?

The field type defines how Solr should interpret data in a field and how the field can be queried. There are many field types included with Solr by default, and they can also be defined locally.

What is positionIncrementGap in SOLR?

positionIncrementGap. For multivalued fields, specifies a distance between multiple values, which prevents spurious phrase matches. autoGeneratePhraseQueries. For text fields. If true , Solr automatically generates phrase queries for adjacent terms.

What is omitNorms SOLR?

omitNorms. If true, omits the norms associated with this field (this disables length normalization for the field, and saves some memory). Defaults to true for all primitive (non-analyzed) field types, such as int, float, data, bool, and string. Only full-text fields or fields need norms.


1 Answers

The _root_ field is needed for block-join support. See here for more detailed explanation.

You can use this when you have relationships between entities and you don't want to flatten your docs, for example, one Class doc, contains many Student docs, and you want to be able to query in a more similar way as you would do it in a traditional relational DB.

Be warned though, that you cannot get all features and flexibility of a Relational DB.

like image 198
Persimmonium Avatar answered Oct 17 '22 22:10

Persimmonium