Multiple type query sortering and filters

Hello,

Working ona mobile app that has to retrieve many doc at startup I am trying to limit the number of queries.
I'm trying to understand how sorting works when querying multiple types

Lets say I want to fetch:

  • settings for either android or ios
  • latest blogposts

Filter

  • if I add [[at(my.settings.is_android, false)]] ==> only settings are returned, blogposts are stripped from response, am I correct ? (feature request here Query by UID on multiple documents)

Sortering

How does sortering work when querying multiple type?

Regards,
Nicolas

Hi Nicolas,

Thanks for contributing to the Prismic community.

May I have the name of the repository that you are trying to query (you can share it with a private message if necessary) in order to better understand your project data structure?

Looking forward to your reply,
Fares

Hi there,

I have noticed that I didn't hear from you recently. Have you found an answer to your query?

In fact regarding

if I add [[at(my.settings.is_android, false)]] ==> only settings are returned, blogposts are stripped from response, am I correct ?

Yes, you are correct with that filter. You get only the documents that have this field "settings.is_android" as false, knowing that this field should exist in all custom types./

And regarding this question:

How does sortering work when querying multiple types?

If you query multiple types such as [any(document.type,["article","page"])] then the API returns the documents sorted by last published date.

And if you add an ordering such as [my.page.uid, my.article.uid], then the API returns first the documents from the first type sorted alphabetically by uid, and then the documents from the second type.

here is a full query example.

Please let us know if you have any other inquires.

This thread has been closed due to inactivity. Flag to reopen.