nodebb-plugin-dbsearch 6.2.2 → 6.2.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/dbsearch.js CHANGED
@@ -177,7 +177,10 @@ search.filterSearchQuery = async function (data) {
177
177
  if (!data || !data.index) {
178
178
  return data;
179
179
  }
180
- const limit = data.index === 'post' ? pluginConfig.postLimit : pluginConfig.topicLimit;
180
+ let limit = data.index === 'post' ? pluginConfig.postLimit : pluginConfig.topicLimit;
181
+ if (data.limit) {
182
+ limit = data.limit;
183
+ }
181
184
  const query = {};
182
185
  if (data.hasOwnProperty('cid')) {
183
186
  query.cid = data.cid;
package/lib/redis.js CHANGED
@@ -73,11 +73,16 @@ exports.chat.search = async (data, limit) => {
73
73
  const query = {
74
74
  matchWords: data.matchWords,
75
75
  query: {
76
- roomId: data.roomId,
77
- uid: data.uid,
78
76
  content: data.content,
79
77
  },
80
78
  };
79
+ ['roomId', 'uid'].forEach((prop) => {
80
+ if (data.hasOwnProperty(prop)) {
81
+ if (Array.isArray(data[prop]) && data[prop].filter(Boolean).length) {
82
+ query.query[prop] = data[prop].filter(Boolean);
83
+ }
84
+ }
85
+ });
81
86
 
82
87
  return await db.chatSearch.query(query, 0, limit - 1);
83
88
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nodebb-plugin-dbsearch",
3
- "version": "6.2.2",
3
+ "version": "6.2.4",
4
4
  "description": "A Plugin that lets users search posts and topics",
5
5
  "main": "index.js",
6
6
  "repository": {