Hi, according to this REST API document and @prismicio/client - v6 guide also the migration guide, I was trying to do a search function in a blog project.
For example, if user type 'dog' in the input area, my query would look like following code and I want the results ordered by publication date.
The custom type id is 'post', and the project is using @prismicio/client v6
client.getAllByType('post', {
predicates: [
prismic.predicate.fulltext("my.post.uid", "dog")
], lang: "en"
}, { orderings: "[document.last_publication_date desc]" });
If I write without predicate, it still not works
client.getAllByType('post', {
lang: 'en',
orderings: {
field: 'document.first_publication_date',
direction: 'desc',
},
});
I can get the result but the result array is not sorted by the last publication date, neither when I change it to last_publication_date
.
Is there anything I didn't write correctly?