When I add new data to the database, I see them instantly (reactively) in my search results.
However they are not appearing at the correct position in the list, according to my sort parameters.
I'm sorting the result to show the most recent at the top, thus expecting to have new data reactively added at the top, but they appear either at the end of the list or after the first result.
How can I force new results to be reactively added at the top (if sorted by date, most recent at top) ?
here are my settings for easysearch :
export const jobofferIndex = new EasySearch.Index({
collection: jobofferCollection,
fields: ['Message','tags','durationType','createdAt','languages','languages.language','certificationRequired','certifications.organisation','locationCountry','locationCity', 'businessName'],
engine: new EasySearch.MongoDB({
sort: function () {
return {createdAt: -1}
},
selector: function(searchObject, options, aggregation) {
let selector = this.defaultConfiguration().selector(searchObject, options, aggregation);
var freedive = {};
if (options.search.props.filterAll) {
return selector;
} else if (options.search.props.filterFunction) {
selector.certificationRequired = options.search.props.filterFunction;
} else if (options.search.props.filterDuration) {
selector.durationType = options.search.props.filterDuration;
} else if (options.search.props.filterFreediving){
freedive.$regex = '.*'+options.search.props.filterFreediving+'.*';
selector.certificationRequired = freedive;
}
return selector;
}
}),
});
Hi @matteodem,
When I add new data to the database, I see them instantly (reactively) in my search results. However they are not appearing at the correct position in the list, according to my sort parameters.
I'm sorting the result to show the most recent at the top, thus expecting to have new data reactively added at the top, but they appear either at the end of the list or after the first result.
How can I force new results to be reactively added at the top (if sorted by date, most recent at top) ?
here are my settings for easysearch :
Thanks for your help