Reputation: 2294
I have a nested object in Solr and i am using Schema in manage schema file. But Solr Storing the nested object in flat manner.
Example :-
{ "id": 1234,
"name":{
"fname":"Random",
"lastName":"Name"
}
}
manage-schema file
<field name="id" type="int" indexed="true" stored="true" required="true" multiValued="false" />
<field name="name" type="string" indexed="true" stored="true" required="true" multiValued="false" />
<field name="name.fName" type="string" indexed="true" stored="true" required="true" multiValued="false" />
<field name="name.lastName" type="string" indexed="true" stored="true" required="true" multiValued="false" />
When is Insert sample data in Solr it Storing data as this
{"id":1234,
"name.fName":"Random",
"name.lastName":"Name"
}
So when i get the data from solr and try to convert to my class object then it is giving me parse error no value for key fName
Please help Thanks
Upvotes: 1
Views: 358
Reputation: 1114
There are 2 main possible approaches in modelling/querying nested objects in Solr : Index Time Join
Imply a very specific indexing strategy, you must index an entire block ( children + parent)
quite fast
Query Time Join
In both these scenarios you don't need any fancy way of naming your fields in the schema ( the nested object functionality has nothing to do with field naming).
Upvotes: 0