Hello everyone :slightly_smiling_face: I鈥檓 plannin...
# community-help
r
Hello everyone 馃檪 I鈥檓 planning to use Typesense, but I have nested objects and object array in my structure. I read that flatting may help me, but in this case the indexing would be tricky, so I had another idea, to split my data into different collections. But in this case I would have trouble with the pagination of the results, or I wasn鈥檛 able to found any example for this. I made this example object to reflect on my real object:
Copy code
{
  "id": "random_id_1",
  "name": "John Doe",
  "read_history": [
    {
      "id": "random_book_id_1",
      "name": "Harry Potter and the Philosopher's Stone",
      "author": "J. K. Rowling"
    },
    {
      "id": "random_book_id_2",
      "name": "Ready Player One",
      "author": "Ernest Cline"
    }
  ],
  "favorite_books": [
    "random_book_id_2"
  ]
}
So here is an example, what I want to do. As result I want to display my readers and their favourite book names in a table, but I want to search in author names and book names as well. In the different index idea, I planned create two indexes, first for general reader data (id, name, favorite_books) and the second would store the read history data with an extra owner_id field to connect the book document to the reader. The indexing was just fine in this case, if I ran a multi collection search I got the results in two different collections, but I want to paginate in the general reader data (and in optimal case, the book data should follow it, based on the shared id, like a SQL join) and not separately. Is there any chance I can do it with Typesense, or I have to merge (fetch and then aggregate) my objects manually?
k
The good news is that we've already begun working on support for nested object and nested array of objects, so that feature will be available in a few weeks time. In the mean time, you can convert the array of objects to simple plain arrays like this:
Copy code
read_history.names: ["Harry Potter and the Philosopher's Stone", "Ready Player One"]

read_history.authors: ["J. K. Rowling", "Ernest Cline"]
馃帀 1
r
Sounds awesome! Looking forward to try it out. Thank you very much for your answer! 馃檪
馃檶 1
One last thing. Is there a ticket somewhere what I can follow to be up-to-date? I鈥檓 pretty interested to try the beta, if this is possible 馃槃
k
Yes, you can follow this issue for updates: https://github.com/typesense/typesense/issues/227 I will post on that issue when I have an early build available for testing.
r
Thank you very much! 馃檪