You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Jagat Singh <ja...@gmail.com> on 2014/03/15 06:14:06 UTC

How to write nested schema.xml in solr

How to write nested schema.xml in solr

The document in schema.xml says

<!-- 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"/>

http://svn.apache.org/viewvc/lucene/dev/trunk/solr/example/solr/collection1/conf/schema.xml?view=markup

Which can be used in

https://cwiki.apache.org/confluence/display/solr/Other+Parsers#OtherParsers-BlockJoinQueryParsers

1)

What will be schema.xml for nesting the following items:

   - Person string
   - Address
      - city string
      - postcode string

2)

I am using Mapreduce to generate index using contrib package. What extra
needs to be done for consuming nested schema's


Thanks.

Re: How to write nested schema.xml in solr

Posted by Jack Krupansky <ja...@basetechnology.com>.
That's for nested "documents", not nested "fields". Nested documents is a 
technique for grouping a block of related documents along with a parent 
document and then being able to join the parent and a child. Solr has no 
support for nested fields - you need to flatten your fields, such as 
"address_city" and "address_postcode", as well as possibly combining the 
address parts into a single string field, "address" for convenient querying. 
You can use a copyField directive for the latter.

-- Jack Krupansky

-----Original Message----- 
From: Jagat Singh
Sent: Saturday, March 15, 2014 1:14 AM
To: solr-user@lucene.apache.org
Subject: How to write nested schema.xml in solr

How to write nested schema.xml in solr

The document in schema.xml says

<!-- 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"/>

http://svn.apache.org/viewvc/lucene/dev/trunk/solr/example/solr/collection1/conf/schema.xml?view=markup

Which can be used in

https://cwiki.apache.org/confluence/display/solr/Other+Parsers#OtherParsers-BlockJoinQueryParsers

1)

What will be schema.xml for nesting the following items:

   - Person string
   - Address
      - city string
      - postcode string

2)

I am using Mapreduce to generate index using contrib package. What extra
needs to be done for consuming nested schema's


Thanks.