Fix and update easysearch

This commit is contained in:
Daniel Kaiser 2022-08-05 13:06:02 +02:00
parent 3ddb97c8c9
commit 339e044a30
11 changed files with 40 additions and 45 deletions

View file

@ -2,6 +2,7 @@
import { SyncedCron } from 'meteor/percolate:synced-cron';
import { TAPi18n } from '/imports/i18n';
import ImpersonatedUsers from './impersonatedUsers';
import { Index, MongoDBEngine } from 'meteor/easy:search'
// Sandstorm context is detected using the METEOR_SETTINGS environment variable
// in the package definition.
@ -537,9 +538,10 @@ Users.allow({
// Search a user in the complete server database by its name, username or emails adress. This
// is used for instance to add a new user to a board.
const searchInFields = ['username', 'profile.fullname', 'emails.address'];
Users.initEasySearch(searchInFields, {
use: 'mongo-db',
returnFields: [...searchInFields, 'profile.avatarUrl'],
Users.search_index = new Index({
collection: Users,
fields: searchInFields,
engine: new MongoDBEngine(),
});
Users.safeFields = {