Fixed searching by tag in slot fillers

This commit is contained in:
Stefan Zermatten
2023-07-19 18:49:18 +02:00
parent b3ed77964f
commit 7072e9ba97

View File

@@ -41,16 +41,21 @@ Meteor.publish('slotFillers', function (slotId, searchTerm, isDummySlot) {
sort: { name: 1 }
});
// Build a filter for nodes in those libraries that match the slot
let filter = getSlotFillFilter({ slot, libraryIds });
this.autorun(function () {
// Build a filter for nodes in those libraries that match the slot
let filter = getSlotFillFilter({ slot, libraryIds });
// Get the limit of the documents the user can fetch
var limit = self.data('limit') || 50;
check(limit, Number);
let options = undefined;
if (searchTerm) {
filter.name = { $regex: escapeRegex(searchTerm), '$options': 'i' };
filter.$and.push({
$or: [
{ name: { $regex: escapeRegex(searchTerm), '$options': 'i' } },
{ libraryTags: searchTerm }
]
});
//filter.$text = { $search: searchTerm };
options = {
// relevant documents have a higher score.