nodebb-plugin-dbsearch 6.5.0 → 7.0.0
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 +14 -14
- package/lib/mongo.js +2 -2
- package/lib/postgres.js +4 -4
- package/lib/redis.js +2 -2
- package/package.json +4 -4
- package/public/admin.js +4 -4
- package/templates/admin/plugins/dbsearch.tpl +2 -2
- package/upgrades/dbsearch_change_integer_index.js +2 -2
- package/upgrades/dbsearch_change_mongodb_schema.js +2 -2
- package/upgrades/dbsearch_mongodb_ts_index.js +2 -2
- package/upgrades/dbsearch_psql_cid_text_index.js +1 -1
package/lib/dbsearch.js
CHANGED
|
@@ -2,19 +2,19 @@
|
|
|
2
2
|
|
|
3
3
|
const _ = require('lodash');
|
|
4
4
|
|
|
5
|
-
const winston =
|
|
6
|
-
const nconf =
|
|
7
|
-
|
|
8
|
-
const db =
|
|
9
|
-
const topics =
|
|
10
|
-
const posts =
|
|
11
|
-
const messaging =
|
|
12
|
-
const utils =
|
|
13
|
-
const socketAdmin =
|
|
14
|
-
const batch =
|
|
15
|
-
const plugins =
|
|
16
|
-
const categories =
|
|
17
|
-
const pubsub =
|
|
5
|
+
const winston = nodebb.require('winston');
|
|
6
|
+
const nconf = nodebb.require('nconf');
|
|
7
|
+
|
|
8
|
+
const db = nodebb.require('./src/database');
|
|
9
|
+
const topics = nodebb.require('./src/topics');
|
|
10
|
+
const posts = nodebb.require('./src/posts');
|
|
11
|
+
const messaging = nodebb.require('./src/messaging');
|
|
12
|
+
const utils = nodebb.require('./src/utils');
|
|
13
|
+
const socketAdmin = nodebb.require('./src/socket.io/admin');
|
|
14
|
+
const batch = nodebb.require('./src/batch');
|
|
15
|
+
const plugins = nodebb.require('./src/plugins');
|
|
16
|
+
const categories = nodebb.require('./src/categories');
|
|
17
|
+
const pubsub = nodebb.require('./src/pubsub');
|
|
18
18
|
|
|
19
19
|
const searchModule = require(`./${nconf.get('database')}`);
|
|
20
20
|
|
|
@@ -70,7 +70,7 @@ function convertLanguageName(name) {
|
|
|
70
70
|
|
|
71
71
|
search.init = async function (params) {
|
|
72
72
|
const { router } = params;
|
|
73
|
-
const routeHelpers =
|
|
73
|
+
const routeHelpers = nodebb.require('./src/routes/helpers');
|
|
74
74
|
routeHelpers.setupAdminPageRoute(router, '/admin/plugins/dbsearch', renderAdmin);
|
|
75
75
|
|
|
76
76
|
router.post('/api/admin/plugins/dbsearch/save', params.middleware.applyCSRF, save);
|
package/lib/mongo.js
CHANGED
package/lib/postgres.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const winston =
|
|
4
|
-
const nconf =
|
|
3
|
+
const winston = nodebb.require('winston');
|
|
4
|
+
const nconf = nodebb.require('nconf');
|
|
5
5
|
|
|
6
|
-
const db =
|
|
7
|
-
const pubsub =
|
|
6
|
+
const db = nodebb.require('./src/database');
|
|
7
|
+
const pubsub = nodebb.require('./src/pubsub');
|
|
8
8
|
|
|
9
9
|
let searchLanguage = 'english';
|
|
10
10
|
|
package/lib/redis.js
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
const redisSearch = require('redisearch');
|
|
4
4
|
|
|
5
|
-
const async =
|
|
5
|
+
const async = nodebb.require('async');
|
|
6
6
|
|
|
7
|
-
const db =
|
|
7
|
+
const db = nodebb.require('./src/database');
|
|
8
8
|
|
|
9
9
|
exports.createIndices = async function () {
|
|
10
10
|
db.postSearch = redisSearch.createSearch('nodebbpostsearch', db.client);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nodebb-plugin-dbsearch",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "7.0.0",
|
|
4
4
|
"description": "A Plugin that lets users search posts and topics",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"repository": {
|
|
@@ -23,10 +23,10 @@
|
|
|
23
23
|
"redisearch": "^2.0.1"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
|
-
"eslint": "^10.
|
|
27
|
-
"eslint-config-nodebb": "^2.0.
|
|
26
|
+
"eslint": "^10.4.1",
|
|
27
|
+
"eslint-config-nodebb": "^2.0.2"
|
|
28
28
|
},
|
|
29
29
|
"nbbpm": {
|
|
30
|
-
"compatibility": "^4.
|
|
30
|
+
"compatibility": "^4.14.0"
|
|
31
31
|
}
|
|
32
32
|
}
|
package/public/admin.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
define('admin/plugins/dbsearch', [
|
|
4
|
-
'alerts', 'admin/settings',
|
|
5
|
-
], function (alerts, settings) {
|
|
4
|
+
'alerts', 'admin/settings', 'modals',
|
|
5
|
+
], function (alerts, settings, modals) {
|
|
6
6
|
const dbsearch = {};
|
|
7
7
|
let intervalId = 0;
|
|
8
8
|
|
|
@@ -32,7 +32,7 @@ define('admin/plugins/dbsearch', [
|
|
|
32
32
|
});
|
|
33
33
|
|
|
34
34
|
$('#reindex').on('click', function () {
|
|
35
|
-
|
|
35
|
+
modals.confirm('Are you sure you want to reindex all content? This might take a while depending on the amount of content. During the operation the forum might slow down.', function (confirm) {
|
|
36
36
|
if (!confirm) {
|
|
37
37
|
return;
|
|
38
38
|
}
|
|
@@ -50,7 +50,7 @@ define('admin/plugins/dbsearch', [
|
|
|
50
50
|
});
|
|
51
51
|
|
|
52
52
|
$('#clear-index').on('click', function () {
|
|
53
|
-
|
|
53
|
+
modals.confirm('Are you sure you want to clear all indices? This might take a while depending on the amount of content. During the operation the forum might slow down.', function (confirm) {
|
|
54
54
|
if (!confirm) {
|
|
55
55
|
return;
|
|
56
56
|
}
|
|
@@ -57,11 +57,11 @@
|
|
|
57
57
|
|
|
58
58
|
<div class="mb-3">
|
|
59
59
|
<label class="form-label">Topic Limit</label>
|
|
60
|
-
<input id="topicLimit" type="
|
|
60
|
+
<input id="topicLimit" type="number" class="form-control" placeholder="Number of topics to return" value="{topicLimit}">
|
|
61
61
|
</div>
|
|
62
62
|
<div class="mb-3">
|
|
63
63
|
<label class="form-label">Post Limit</label>
|
|
64
|
-
<input id="postLimit" type="
|
|
64
|
+
<input id="postLimit" type="number" class="form-control" placeholder="Number of posts to return" value="{postLimit}">
|
|
65
65
|
</div>
|
|
66
66
|
|
|
67
67
|
<!-- IF mongoBackend -->
|
|
@@ -8,13 +8,13 @@ module.exports = {
|
|
|
8
8
|
timestamp: Date.UTC(2025, 0, 27),
|
|
9
9
|
method: async function () {
|
|
10
10
|
const { progress } = this;
|
|
11
|
-
const nconf =
|
|
11
|
+
const nconf = nodebb.require('nconf');
|
|
12
12
|
const mainDB = nconf.get('database');
|
|
13
13
|
if (mainDB === 'redis') {
|
|
14
14
|
// redis is not affected, since everything is string already
|
|
15
15
|
return;
|
|
16
16
|
}
|
|
17
|
-
const batch =
|
|
17
|
+
const batch = nodebb.require('./src/batch');
|
|
18
18
|
async function convertIdToString(collection, docs) {
|
|
19
19
|
await batch.processArray(docs, async (docs) => {
|
|
20
20
|
await db.client.collection(collection).deleteMany({
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
const winston =
|
|
4
|
+
const winston = nodebb.require('winston');
|
|
5
5
|
const db = module.parent.require('./database');
|
|
6
6
|
|
|
7
7
|
module.exports = {
|
|
8
8
|
name: 'Changing dbsearch mongodb search schema to use _id',
|
|
9
9
|
timestamp: Date.UTC(2018, 10, 26),
|
|
10
10
|
method: async function () {
|
|
11
|
-
const nconf =
|
|
11
|
+
const nconf = nodebb.require('nconf');
|
|
12
12
|
const isMongo = nconf.get('database') === 'mongo';
|
|
13
13
|
if (!isMongo) {
|
|
14
14
|
return;
|
|
@@ -8,8 +8,8 @@ module.exports = {
|
|
|
8
8
|
timestamp: Date.UTC(2025, 1, 18),
|
|
9
9
|
method: async function () {
|
|
10
10
|
const { progress } = this;
|
|
11
|
-
const nconf =
|
|
12
|
-
const batch =
|
|
11
|
+
const nconf = nodebb.require('nconf');
|
|
12
|
+
const batch = nodebb.require('./src/batch');
|
|
13
13
|
const isMongo = nconf.get('database') === 'mongo';
|
|
14
14
|
if (!isMongo) {
|
|
15
15
|
return;
|
|
@@ -7,7 +7,7 @@ module.exports = {
|
|
|
7
7
|
name: 'Changing integer cid index to text for psql',
|
|
8
8
|
timestamp: Date.UTC(2025, 6, 8),
|
|
9
9
|
method: async function () {
|
|
10
|
-
const nconf =
|
|
10
|
+
const nconf = nodebb.require('nconf');
|
|
11
11
|
const mainDB = nconf.get('database');
|
|
12
12
|
if (mainDB !== 'postgres') {
|
|
13
13
|
return;
|