[ 
https://issues.apache.org/jira/browse/SOLR-12298?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16465110#comment-16465110
 ] 

mosh edited comment on SOLR-12298 at 5/6/18 12:44 PM:
------------------------------------------------------

An URP could be used to add those fields, but that will not prevent the need 
for a new JSON loader, since the current one requires the _childDocument_ to be 
added at each level. This could be prevented only by writing a new JSON loader, 
which will override the 
[parseExtendedFieldValue|https://github.com/apache/lucene-solr/blob/1b760114216fcdfae138a8b37f183a9293c49115/solr/core/src/java/org/apache/solr/handler/loader/JsonLoader.java#L564]
 function. The overridden function should populate the needed fields 
(__nestLevel__, _nestPath_, _nestParent_),
 since the current JSON loader does not support regular nested JSON. Does this 
warrant the addition of a new URP?

The _nestPath_ field will contain the name of the key at each level, e.g. 
"post.comment" for the child {"a": "b", "post": {"comment" : *

{"reply" : "a"}

*}}, the child solr document ending up as { "reply": "a", "_nestLevel_" : 2, 
"_nestParent_": parentId, "_root_": rootDocId, "_nestPath_": "post.comment" }

adding a "nest" prefix to each special fields sounds like a good way to 
differentiate them from other fields.


was (Author: moshebla):
An URP could be used to add those fields, but that will not prevent the need 
for a new JSON loader, since the current one requires the _childDocument_ to be 
added at each level. This could be prevented only by writing a new JSON loader, 
which will override the 
[parseExtendedFieldValue|https://github.com/apache/lucene-solr/blob/1b760114216fcdfae138a8b37f183a9293c49115/solr/core/src/java/org/apache/solr/handler/loader/JsonLoader.java#L564]
 function. The overridden function should populate the needed fields 
(_nestLevel_, _nestPath_, _nestParent_),
since the current JSON loader does not support regular nested json.

The _nestPath_ field will contain the name of the key at each level, e.g. 
"post.comment" for the child {"a": "b", "post": {"comment" : *{"reply" : 
"a"}*}}, the child solr document ending up as \{ "reply": "a", "_nestLevel_" : 
2, "_nestParent_": parentId, "_root_": rootDocId, "_nestPath_": "post.comment" }

adding a "nest" prefix to each special fields sounds like a good way to 
differentiate them from other fields.

> Index Full nested document Hierarchy For Queries (umbrella issue)
> -----------------------------------------------------------------
>
>                 Key: SOLR-12298
>                 URL: https://issues.apache.org/jira/browse/SOLR-12298
>             Project: Solr
>          Issue Type: Improvement
>      Security Level: Public(Default Security Level. Issues are Public) 
>            Reporter: mosh
>            Priority: Major
>
> Solr ought to have the ability to index deeply nested objects, while storing 
> the original document hierarchy.
>  Currently the client has to index the child document's full path and level 
> to manually reconstruct the original document structure, since the children 
> are flattened and returned in the reserved "__childDocuments__" key.
> Ideally you could index a nested document, having Solr transparently add the 
> required fields while providing a document transformer to rebuild the 
> original document's hierarchy.
>  
> This issue is an umbrella issue for the particular tasks that will make it 
> all happen – either subtasks or issue linking.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to