0

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?

0

1 Answer 1

1

As you say, flattening the docs is no problem at all in Solr, even though from a SQL standpoint looks wasteful.

But, if you want to keep a more SQL-like relationships, look at Block joins in Solr. I would go with flattening unless joins are strongly required, it would simplify your config.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.