Data structure question

Hi all, I have a data structure question.

Let’s say I have the following setup:

Movie (collection)
-description
-title

Actor (collection)
-name
-sex
-movie (cross reference)

Review (collection)
-rating
-date
-movie (cross reference)

And most of the time, I want to do a hybrid search in this way:

query: “XYZ”
filter: “over all acters where movie == 'AvengerMovieUID”

So basically, I’m only interested in the actors related to a particular movie

And, I’ll rarely need to ever search the actual movie itself, I’m only interested in querying Actors or Reviews on the movie.So questions:

  1. Should I make a cross reference to Movie? Or should I just put the movieUID as a field inside the actor and review objects, and apply a simple filter over this UID in a flat way (noSQL style)

  2. Do I need to make a 2 way cross reference If I want to sometimes find all acters where movie == X, and also on the movie side, query all related actors?

Hi @typefox09 ! Welcome to our community! :hugs:

considering your structure, you doesn’t seem to need the cross reference, as you will be querying actors and queries.

Now, without the cross reference, if you want some additional information of the movie that is stored, you will need to do a second query, as you will not be able to get it from the actor/review object directly.

for 2 you are right, you will need a two way cross reference for that

Some heads up:

  • Remember to mark the ID property as skip:True, as you will probably not want that field to be vectorized.
  • For the field you will be using as ID, it’s a good idea to set the tokenization to field otherwise if you id is something like review-1, the default tokenization being word, it will render you with a token review1

Let me know if this helps.

If you need any further assistance, we are here to help :slight_smile: