Hello, what happens is that I have a page with react that uses the package:
@elastic/search-ui-site-search-connector
Through the configuration and the query I bring information and already display it visually.
The problem is that I want to sort the results by date but even if I add the sort property, it doesn't do it, I tried to do it even with a simple and more common field as title but it doesn't sort even if I do it.
I try to use sort property like the next way:
"sort": [{"createdPageDate.raw": {"order": "desc"}}]
sort: [{ createdPageDate: { order: 'desc' } }]
sort: [{ "createdPageDate": { "order": 'desc' } }]
"sort": [{ "createdPageDate": { "order": 'desc' } }]
sort: {createdPageDate : 'desc'},
sort: {
field: "createdPageDate",
order: "desc",
}
This is the query and config that I use:
const searchConnector = new SiteSearchAPIConnector({
engineKey: apikey,
documentType: "page"
});
const config = {
apiConnector: searchConnector,
autocompleteQuery: {
suggestions: {
types: {
documents: {
fields: ["title"]
}
},
size: 4
}
},
searchQuery: {
search_fields:
{
title: {},
description: {}
},
result_fields: {
title: {
raw: {}
},
createdPageDate: {
raw: {}
},
link: {
raw: {}
},
page_id: {
raw: {}
},
content_type: {
raw: {}
},
},
facets: {
content_type: {type: "value"},
size: {type: "value"}
},
},
alwaysSearchOnInitialLoad: true,
};
// RENDER THE RESULT ON VISUAL FORM
<SearchProvider config={config}>
<Results
resultView={({result}) => {
if (result.content_type !== undefined) {
// REST OF THE CODE
/>
</SearchProvider>