nodebb-plugin-dbsearch 6.2.3 → 6.2.5
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 +8 -3
- package/package.json +1 -1
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
|
-
|
|
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;
|
|
@@ -270,7 +273,8 @@ async function reIndexTopics() {
|
|
|
270
273
|
|
|
271
274
|
async function topicsSave(topics) {
|
|
272
275
|
topics = topics.filter(
|
|
273
|
-
t => t && t.tid && parseInt(t.deleted, 10) !== 1 &&
|
|
276
|
+
t => t && utils.isNumber(t.tid) && parseInt(t.deleted, 10) !== 1 &&
|
|
277
|
+
!pluginConfig.excludeCategories.includes(String(t.cid))
|
|
274
278
|
);
|
|
275
279
|
|
|
276
280
|
let data = topics.map((topicData) => {
|
|
@@ -322,7 +326,8 @@ async function reIndexPosts() {
|
|
|
322
326
|
|
|
323
327
|
async function postsSave(posts) {
|
|
324
328
|
posts = posts.filter(
|
|
325
|
-
p => p && p.pid && parseInt(p.deleted, 10) !== 1 &&
|
|
329
|
+
p => p && utils.isNumber(p.pid) && parseInt(p.deleted, 10) !== 1 &&
|
|
330
|
+
!pluginConfig.excludeCategories.includes(String(p.cid))
|
|
326
331
|
);
|
|
327
332
|
|
|
328
333
|
let data = posts.map((postData) => {
|