From 7072e9ba971be5fdbb308b4336982827a6d22d32 Mon Sep 17 00:00:00 2001 From: Stefan Zermatten Date: Wed, 19 Jul 2023 18:49:18 +0200 Subject: [PATCH] Fixed searching by tag in slot fillers --- app/imports/server/publications/slotFillers.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/app/imports/server/publications/slotFillers.js b/app/imports/server/publications/slotFillers.js index fba54ca6..207ba336 100644 --- a/app/imports/server/publications/slotFillers.js +++ b/app/imports/server/publications/slotFillers.js @@ -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.