Fixed search for library prop not using tags

This commit is contained in:
Stefan Zermatten
2023-06-23 23:29:46 +02:00
parent 2c89323764
commit 93dfbc8a93

View File

@@ -86,7 +86,13 @@ Meteor.publish('searchLibraryNodes', function (creatureId) {
let options = undefined;
if (searchTerm) {
filter.name = { $regex: escapeRegex(searchTerm), '$options': 'i' };
// Regex search instead of text index
filter.$and = [{
$or: [
{ name: { $regex: escapeRegex(searchTerm), '$options': 'i' } },
{ libraryTags: searchTerm },
],
}];
// filter.$text = {$search: searchTerm};
options = {
/*
@@ -105,7 +111,7 @@ Meteor.publish('searchLibraryNodes', function (creatureId) {
}
} else {
//delete filter.$text
delete filter.name;
delete filter.$and;
options = {
sort: {
'ancestors.0.id': 1,