mirror of
https://github.com/wekan/wekan.git
synced 2025-04-22 21:17:18 -04:00
start work on searching in comments
This commit is contained in:
parent
b40d53df84
commit
dd163b9923
4 changed files with 22 additions and 0 deletions
|
@ -212,6 +212,7 @@ BlazeComponent.extendComponent({
|
|||
'operator-due': 'dueAt',
|
||||
'operator-created': 'createdAt',
|
||||
'operator-modified': 'modifiedAt',
|
||||
'operator-comment': 'comments',
|
||||
};
|
||||
|
||||
const operatorMap = {};
|
||||
|
@ -233,6 +234,7 @@ BlazeComponent.extendComponent({
|
|||
dueAt: null,
|
||||
createdAt: null,
|
||||
modifiedAt: null,
|
||||
comments: [],
|
||||
};
|
||||
|
||||
let text = '';
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
const escapeForRegex = require('escape-string-regexp');
|
||||
Boards = new Mongo.Collection('boards');
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
const escapeForRegex = require('escape-string-regexp');
|
||||
CardComments = new Mongo.Collection('card_comments');
|
||||
|
||||
/**
|
||||
|
@ -109,6 +110,22 @@ function commentCreation(userId, doc) {
|
|||
});
|
||||
}
|
||||
|
||||
CardComments.textSearch = (userId, textArray) => {
|
||||
const selector = {
|
||||
boardId: { $in: Boards.userBoardIds() },
|
||||
$and: [],
|
||||
};
|
||||
|
||||
for (const text of textArray) {
|
||||
selector.$and.push({ text: new RegExp(escapeForRegex(text)) });
|
||||
}
|
||||
|
||||
// eslint-disable-next-line no-console
|
||||
console.log(textArray);
|
||||
|
||||
return CardComments.find(selector);
|
||||
};
|
||||
|
||||
if (Meteor.isServer) {
|
||||
// Comments are often fetched within a card, so we create an index to make these
|
||||
// queries more efficient.
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
const escapeForRegex = require('escape-string-regexp');
|
||||
|
||||
Cards = new Mongo.Collection('cards');
|
||||
|
||||
// XXX To improve pub/sub performances a card document should include a
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue