I have a Doc[id, text, creator, date] object which has a one-many relationship with Topic[name, description, sentiment] objects. Here is one way to design this schema
A fully flat structure, i.e. 1 field for each doc property and 3 fields each for each topic. So, if I have 5 topics for a doc, I will have 3*5=15 Topic fields. The problem is this is too flat and I am losing the hierarchy. Moreover, as every doc will have a different topic count, I have to allocate a large number of fields for topics irrespective of whether I need it or not. I guess this is not a problem in SOLR but it is not flexible from a programming and data storage point of view. Moreover, I also will like to query on each of this doc and topic properties.
Is there a better SOLR way which is more structured and hierarchical?