Fixed references sorting first in slot fillers

This commit is contained in:
ThaumRystra
2024-09-06 21:40:39 +02:00
parent b867cf182b
commit 679a123a2a

View File

@@ -109,16 +109,12 @@ Meteor.publish('slotFillers', function (slotId, searchTerm, isDummySlot) {
{ libraryTags: searchTerm } { libraryTags: searchTerm }
] ]
}); });
//filter.$text = { $search: searchTerm };
options = { options = {
// relevant documents have a higher score.
fields: { fields: {
//_score: { $meta: 'textScore' },
...LIBRARY_NODE_TREE_FIELDS, ...LIBRARY_NODE_TREE_FIELDS,
}, },
sort: { sort: {
// `score` property specified in the projection fields above. 'cache.node.name': 1,
//_score: { $meta: 'textScore' },
name: 1, name: 1,
order: 1, order: 1,
} }
@@ -128,6 +124,9 @@ Meteor.publish('slotFillers', function (slotId, searchTerm, isDummySlot) {
delete filter.name delete filter.name
options = { options = {
sort: { sort: {
// References sorted in name order, but with non-references first, because undefined
// is sorted before docs with cached name defined
'cache.node.name': 1,
name: 1, name: 1,
order: 1, order: 1,
}, },