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 santosh sidnal <si...@gmail.com> on 2015/12/14 01:40:03 UTC
Defining SOLR nested fields
Hi All,
I want to define nested fileds in SOLR using schema.xml. we are using Apache
Solr 4.7.0.
i see some links which says how to do, but not sure how can i do it in
schema.xml
https://cwiki.apache.org/confluence/display/solr/Other+Parsers#OtherParsers-BlockJoinQueryParsers
any help over here is appreciable.
--
Regards,
Santosh Sidnal
Re: Defining SOLR nested fields
Posted by Tom Evans <te...@googlemail.com>.
On Sun, Dec 13, 2015 at 6:40 PM, santosh sidnal
<si...@gmail.com> wrote:
> Hi All,
>
> I want to define nested fileds in SOLR using schema.xml. we are using Apache
> Solr 4.7.0.
>
> i see some links which says how to do, but not sure how can i do it in
> schema.xml
> https://cwiki.apache.org/confluence/display/solr/Other+Parsers#OtherParsers-BlockJoinQueryParsers
>
>
> any help over here is appreciable.
>
With nested documents, it is better to not think of them as
"children", but as related documents. All the documents in your index
will follow exactly the same schema, whether they are "children" or
"parents", and the nested aspect of a a document simply allows you to
restrict your queries based upon that relationship.
Solr is extremely efficient dealing with sparse documents (docs with
only a few fields defined), so one way is to define all your fields
for "parent" and "child" in the schema, and only use the appropriate
ones in the right document. Another way is to use a schema-less
structure, although I'm not a fan of that for error checking reasons.
You can also define a suffix or prefix for fields that you use as part
of your methodology, so that you know what domain it belongs in, but
that would just be for your benefit, Solr would not complain if you
put a "child" field in a parent or vice-versa.
Cheers
Tom
PS:
I would not use Solr 4.7 for this. Nested docs are a new-ish feature,
you may encounter bugs that have been fixed in later versions, and
performance has certainly been improved in later versions. Faceting on
a specific domain (eg, on children or parents) is only supported by
the JSON facet API, which was added in 5.2, and the current stable
version of Solr is 5.4.
Re: Defining SOLR nested fields
Posted by Alessandro Benedetti <ab...@apache.org>.
Exacly, In Solr there is no concept of "nested fields" .
But there's the concept of nested documents ( via Query time join and Index
time (block) join ) .
You can have a "flat" schema which actually will be used to model nested
documents at index and query time.
There is plenty of documentation about that ( starting from 4.5 block join
is available in Solr as well)
Cheers
On 14 December 2015 at 03:18, Binoy Dalal <bi...@gmail.com> wrote:
> From what I've seen, you can't nest fields in the schema.xml, since those
> are just declarations. If you want nested documents, you need to do so at
> index time with the _childDocuments_ json key in your doc.
> Take a look here: http://yonik.com/solr-nested-objects/
>
> On Mon, Dec 14, 2015 at 6:10 AM santosh sidnal <si...@gmail.com>
> wrote:
>
> > Hi All,
> >
> > I want to define nested fileds in SOLR using schema.xml. we are using
> > Apache
> > Solr 4.7.0.
> >
> > i see some links which says how to do, but not sure how can i do it in
> > schema.xml
> >
> >
> https://cwiki.apache.org/confluence/display/solr/Other+Parsers#OtherParsers-BlockJoinQueryParsers
> >
> >
> > any help over here is appreciable.
> >
> > --
> > Regards,
> > Santosh Sidnal
> >
> --
> Regards,
> Binoy Dalal
>
--
--------------------------
Benedetti Alessandro
Visiting card : http://about.me/alessandro_benedetti
"Tyger, tyger burning bright
In the forests of the night,
What immortal hand or eye
Could frame thy fearful symmetry?"
William Blake - Songs of Experience -1794 England
Re: Defining SOLR nested fields
Posted by Binoy Dalal <bi...@gmail.com>.
>From what I've seen, you can't nest fields in the schema.xml, since those
are just declarations. If you want nested documents, you need to do so at
index time with the _childDocuments_ json key in your doc.
Take a look here: http://yonik.com/solr-nested-objects/
On Mon, Dec 14, 2015 at 6:10 AM santosh sidnal <si...@gmail.com>
wrote:
> Hi All,
>
> I want to define nested fileds in SOLR using schema.xml. we are using
> Apache
> Solr 4.7.0.
>
> i see some links which says how to do, but not sure how can i do it in
> schema.xml
>
> https://cwiki.apache.org/confluence/display/solr/Other+Parsers#OtherParsers-BlockJoinQueryParsers
>
>
> any help over here is appreciable.
>
> --
> Regards,
> Santosh Sidnal
>
--
Regards,
Binoy Dalal