@jasonwch/nodebb-plugin-meilisearch-r 1.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/library.js +1136 -0
- package/package.json +24 -0
- package/plugin.json +123 -0
- package/static/languages/en-GB/meilisearch.json +67 -0
- package/static/languages/pl/meilisearch.json +65 -0
- package/static/languages/zh-CN/meilisearch.json +65 -0
- package/static/less/meilisearch.less +110 -0
- package/static/lib/admin.js +139 -0
- package/static/lib/client/quick-search.js +161 -0
- package/static/scss/meilisearch.scss +104 -0
- package/static/templates/admin/plugins/meilisearch/partials/rankingRules/form.tpl +7 -0
- package/static/templates/admin/plugins/meilisearch/partials/rankingRules/item.tpl +11 -0
- package/static/templates/admin/plugins/meilisearch/partials/stopWords/form.tpl +7 -0
- package/static/templates/admin/plugins/meilisearch/partials/stopWords/item.tpl +11 -0
- package/static/templates/admin/plugins/meilisearch/partials/synonyms/form.tpl +9 -0
- package/static/templates/admin/plugins/meilisearch/partials/synonyms/item.tpl +12 -0
- package/static/templates/admin/plugins/meilisearch/partials/typoToleranceDisableOnWords/form.tpl +6 -0
- package/static/templates/admin/plugins/meilisearch/partials/typoToleranceDisableOnWords/item.tpl +11 -0
- package/static/templates/admin/plugins/meilisearch.tpl +184 -0
- package/static/templates/client/partials/quick-search-header.tpl +4 -0
package/package.json
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@jasonwch/nodebb-plugin-meilisearch-r",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "(Compatible with 4.14.X and refactored from original meilisearch plugin) A plugin for integrating MeiliSearch with NodeBB",
|
|
5
|
+
"main": "library.js",
|
|
6
|
+
"scripts": {},
|
|
7
|
+
"keywords": [
|
|
8
|
+
"nodebb",
|
|
9
|
+
"plugin",
|
|
10
|
+
"meilisearch",
|
|
11
|
+
"shell"
|
|
12
|
+
],
|
|
13
|
+
"author": {
|
|
14
|
+
"name": "JasonCH",
|
|
15
|
+
"email": "jasonwch@msn.com"
|
|
16
|
+
},
|
|
17
|
+
"license": "MIT",
|
|
18
|
+
"nbbpm": {
|
|
19
|
+
"compatibility": "^4.14.0"
|
|
20
|
+
},
|
|
21
|
+
"dependencies": {
|
|
22
|
+
"meilisearch": "0.59.0"
|
|
23
|
+
}
|
|
24
|
+
}
|
package/plugin.json
ADDED
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "nodebb-plugin-meilisearch-r",
|
|
3
|
+
"name": "NodeBB meilisearch refactored",
|
|
4
|
+
"description": "(Compatible with 4.14.X and refactored from original meilisearch plugin) A plugin for integrating MeiliSearch with NodeBB",
|
|
5
|
+
"library": "./library.js",
|
|
6
|
+
"hooks": [
|
|
7
|
+
{
|
|
8
|
+
"hook": "static:app.load",
|
|
9
|
+
"method": "init"
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
"hook": "static:api.routes",
|
|
13
|
+
"method": "addRoutes"
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
"hook": "filter:admin.header.build",
|
|
17
|
+
"method": "addAdminNavigation"
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"hook": "filter:admin.notices",
|
|
21
|
+
"method": "getNotices"
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
"hook": "action:post.save",
|
|
25
|
+
"method": "indexPost"
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
"hook": "action:post.edit",
|
|
29
|
+
"method": "indexPost"
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
"hook": "action:post.move",
|
|
33
|
+
"method": "indexPost"
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
"hook": "action:post.restore",
|
|
37
|
+
"method": "indexPost"
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
"hook": "action:post.delete",
|
|
41
|
+
"method": "deindexPost"
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
"hook": "action:post.changeOwner",
|
|
45
|
+
"method": "changePostOwner"
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
"hook": "action:posts.purge",
|
|
49
|
+
"method": "deindexPostsPurge"
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
"hook": "action:topic.post",
|
|
53
|
+
"method": "indexTopic"
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
"hook": "action:topic.save",
|
|
57
|
+
"method": "indexTopic"
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
"hook": "action:topic.restore",
|
|
61
|
+
"method": "restoreTopic"
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
"hook": "action:topic.edit",
|
|
65
|
+
"method": "indexTopic"
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
"hook": "action:topic.move",
|
|
69
|
+
"method": "indexTopic"
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
"hook": "action:topic.merge",
|
|
73
|
+
"method": "onTopicMerge"
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
"hook": "action:topic.delete",
|
|
77
|
+
"method": "deindexTopic"
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
"hook": "action:topic.changeOwner",
|
|
81
|
+
"method": "changeTopicOwner"
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
"hook": "action:topics.purge",
|
|
85
|
+
"method": "deindexTopicsPurge"
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
"hook": "action:topics.scheduled.notify",
|
|
89
|
+
"method": "onScheduledPublish"
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
"hook": "filter:search.query",
|
|
93
|
+
"method": "search"
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
"hook": "filter:topic.search",
|
|
97
|
+
"method": "search"
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
"hook": "filter:settings.set",
|
|
101
|
+
"method": "saveSettings"
|
|
102
|
+
}
|
|
103
|
+
],
|
|
104
|
+
"staticDirs": {
|
|
105
|
+
"static": "./static"
|
|
106
|
+
},
|
|
107
|
+
"scss": [
|
|
108
|
+
"static/scss/meilisearch.scss"
|
|
109
|
+
],
|
|
110
|
+
"less": [
|
|
111
|
+
"static/less/meilisearch.less"
|
|
112
|
+
],
|
|
113
|
+
"modules": {
|
|
114
|
+
"../admin/plugins/meilisearch.js": "./static/lib/admin.js"
|
|
115
|
+
},
|
|
116
|
+
"scripts": [
|
|
117
|
+
"static/lib/client/quick-search.js"
|
|
118
|
+
],
|
|
119
|
+
"templates": "static/templates",
|
|
120
|
+
"settingsRoute": "/admin/plugins/meilisearch",
|
|
121
|
+
"languages": "static/languages",
|
|
122
|
+
"defaultLang": "en-GB"
|
|
123
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
{
|
|
2
|
+
"admin.settings": "Meilisearch Settings",
|
|
3
|
+
"admin.connection": "Connection settings",
|
|
4
|
+
"admin.host": "Meilisearch URL",
|
|
5
|
+
"admin.apiKey": "API Key",
|
|
6
|
+
"admin.healthCheckInterval": "Health check interval (in seconds)",
|
|
7
|
+
"admin.search": "Search options",
|
|
8
|
+
"admin.maxDocuments": "Max number of documents returned",
|
|
9
|
+
"admin.searchMinTermLength": "Minimum search term length",
|
|
10
|
+
"admin.searchMinTermLengthHelp": "Queries in which every word is shorter than this (in characters) are skipped. Minimum 2. Dodges a NodeBB core highlight bug that surfaces on 1-character searches.",
|
|
11
|
+
"admin.rankingRules": "Ranking rules",
|
|
12
|
+
"admin.rankingRulesHelp": "In order to ensure relevant results, search responses are sorted based on a set of consecutive rules called ranking rules. For more information read the docs here:",
|
|
13
|
+
"admin.rankingRulesFormLabel": "Rule",
|
|
14
|
+
"admin.rankingRulesFormHelp": "Use the following syntax for custom rules: 'attribute:asc' or 'attribute:desc'. For more information read the documentation here:",
|
|
15
|
+
"admin.addRankingRule": "Add a ranking rule",
|
|
16
|
+
"admin.stopWords": "Stop words",
|
|
17
|
+
"admin.stopWordsHelp": "Stop words are stripped from a search query only when the query also contains at least one non-stop word. If the entire query consists of stop words, Meilisearch will still search using that term (it is not ignored). For more information on Meilisearch's stop word behavior, see:",
|
|
18
|
+
"admin.stopWordsFormLabel": "Stop word",
|
|
19
|
+
"admin.stopWordsFormHelp": "For more information read the documentation here:",
|
|
20
|
+
"admin.addStopWord": "Add a stop word",
|
|
21
|
+
"admin.synonyms": "Synonyms",
|
|
22
|
+
"admin.synonymsHelp": "Words that Meilisearch should consider as having equivalent meaning in order to make search results more relevant. For more information read the docs here:",
|
|
23
|
+
"admin.synonymsWordFormLabel": "Word",
|
|
24
|
+
"admin.synonymsSynonymsFormLabel": "Synonyms",
|
|
25
|
+
"admin.synonymsFormHelp": "Add synonyms as a comma separated list (eg. 'word,utterance,phrase')",
|
|
26
|
+
"admin.addSynonym": "Add a word with synonym",
|
|
27
|
+
"admin.typoTolerance": "Typo tolerance",
|
|
28
|
+
"admin.typoToleranceEnable": "Enable typo tolerance",
|
|
29
|
+
"admin.typoToleranceMinWordSizeOneTypo": "Minimum word size for one typo",
|
|
30
|
+
"admin.typoToleranceMinWordSizeTwoTypos": "Minimum word size for two typos",
|
|
31
|
+
"admin.typoToleranceDisableOnWords": "Disable typo tolerance on specified words",
|
|
32
|
+
"admin.typoToleranceDisableOnWordsHelp": "Typo tolerance is disabled only when one of these words is typed exactly in the search query; that query word will not match typo variants in the index. Note: searching a misspelling of a disabled word will still match the correctly-spelled document via tolerance. For more information see:",
|
|
33
|
+
"admin.typoToleranceDisableOnWordsFormLabel": "Typo-tolerance disabled word",
|
|
34
|
+
"admin.addTypoToleranceDisabledWord": "Add a typo-tolerance disabled word",
|
|
35
|
+
"admin.actions": "Actions",
|
|
36
|
+
"admin.index": "Index",
|
|
37
|
+
"admin.reindex": "Reindex",
|
|
38
|
+
"admin.forceReindex": "Force reindex (delete all documents)",
|
|
39
|
+
"admin.reindexHelp": "Index all posts and topics again, in case of a mismatch between Meilisearch and NodeBB. This can take a while depending on the number of posts and topics in your forum.",
|
|
40
|
+
"admin.confirmReindex": "Are you sure you want to start reindexing all posts and topics?<br>This operation can take a while.",
|
|
41
|
+
"admin.reindexPostsProgress": "Reindexing posts...",
|
|
42
|
+
"admin.reindexTopicsProgress": "Reindexing topics...",
|
|
43
|
+
"admin.save": "save",
|
|
44
|
+
"admin.edit": "edit",
|
|
45
|
+
"admin.delete": "delete",
|
|
46
|
+
"admin.lastReindex": "Last reindex",
|
|
47
|
+
"admin.lastReindexDate": "finished",
|
|
48
|
+
"admin.lastReindexCounts": "Indexed",
|
|
49
|
+
"admin.lastReindexSuccess": "Completed successfully",
|
|
50
|
+
"admin.lastReindexFailed": "Failed",
|
|
51
|
+
"admin.lastReindexStatus": "Status",
|
|
52
|
+
"admin.lastReindexTopics": "Topics",
|
|
53
|
+
"admin.lastReindexPosts": "Posts",
|
|
54
|
+
"admin.lastReindexSkippedDeletedTopics": "Skipped (deleted topics)",
|
|
55
|
+
"admin.lastReindexSkippedDeletedPosts": "Skipped (deleted posts)",
|
|
56
|
+
"admin.lastReindexError": "Error",
|
|
57
|
+
"admin.reindexingCompleted": "Reindexing Completed",
|
|
58
|
+
"admin.reindexingCompletedBody": "Reindexing completed successfully",
|
|
59
|
+
"admin.settingsSaved": "Settings Saved",
|
|
60
|
+
"admin.settingsSavedBody": "Your settings have been saved successfully.",
|
|
61
|
+
"admin.meiliUnreachable": "MeiliSearch Unreachable",
|
|
62
|
+
"admin.meiliUnreachableBody": "Settings were saved, but MeiliSearch is unreachable. Index settings will apply when connection is restored.",
|
|
63
|
+
"admin.indexingStarted": "Indexing started",
|
|
64
|
+
"admin.indexingStartedBody": "Reindexing is running in the background. Progress will appear below.",
|
|
65
|
+
"similar-topics-header": "Your topic is similar to…",
|
|
66
|
+
"esc": "esc"
|
|
67
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
{
|
|
2
|
+
"admin.settings": "Ustawienia Meilisearch",
|
|
3
|
+
"admin.connection": "Ustawienia połączenia",
|
|
4
|
+
"admin.host": "Meilisearch URL",
|
|
5
|
+
"admin.apiKey": "Klucz API",
|
|
6
|
+
"admin.healthCheckInterval": "Odstęp pomiędzy między sprawdzeniami stanu MeiliSearch (w sekundach)",
|
|
7
|
+
"admin.search": "Ustawienia wyszukiwania",
|
|
8
|
+
"admin.maxDocuments": "Maksymalna liczba zwracanych dokumentów",
|
|
9
|
+
"admin.searchMinTermLength": "Minimalna długość wyszukiwanego słowa",
|
|
10
|
+
"admin.searchMinTermLengthHelp": "Zapytania, w których każde słowo jest krótsze niż ta wartość (w znakach), są pomijane. Minimum 2. Omija błąd podświetlania w NodeBB ujawniający się przy wyszukiwaniu jednoliterowym.",
|
|
11
|
+
"admin.rankingRules": "Zasady sortowania",
|
|
12
|
+
"admin.rankingRulesHelp": "By usprawnić wyszukiwanie wyniki są sortowane według tych zasad. By dowiedzieć się więcej zobacz dokumentację:",
|
|
13
|
+
"admin.rankingRulesFormLabel": "Zasada",
|
|
14
|
+
"admin.rankingRulesFormHelp": "Użyj tego formatu do własnych zasad: 'attribute:asc' or 'attribute:desc'. By dowiedzieć się więcej zobacz dokumentację:",
|
|
15
|
+
"admin.addRankingRule": "Dodaj zasadę sortowania",
|
|
16
|
+
"admin.stopWords": "Słowa nieinformatywne",
|
|
17
|
+
"admin.stopWordsHelp": "Słowa nieinformatywne będą ignorowane przez wyszukiwarnę. By dowiedzieć się więcej zobacz dokumentację:",
|
|
18
|
+
"admin.stopWordsFormLabel": "Słowo nieinformatywne",
|
|
19
|
+
"admin.stopWordsFormHelp": "By dowiedzieć się więcej zobacz dokumentację:",
|
|
20
|
+
"admin.addStopWord": "Dodaj słowo nieinformatywne",
|
|
21
|
+
"admin.synonyms": "Synonimy",
|
|
22
|
+
"admin.synonymsHelp": "Słowa które Meilisearch uznaje za oznaczające to samo w celu usprawnienia wyników. By dowiedzieć się więcej zobacz dokumentację:",
|
|
23
|
+
"admin.synonymsWordFormLabel": "Słowo",
|
|
24
|
+
"admin.synonymsSynonymsFormLabel": "Synonimy",
|
|
25
|
+
"admin.synonymsFormHelp": "Dodaj synonimy jako lista rozdzielonych przecinkiem słów (eg. 'słowo,wyraz,fraza')",
|
|
26
|
+
"admin.addSynonym": "Dodaj słowo z synonimami",
|
|
27
|
+
"admin.typoTolerance": "Tolerancja literówek",
|
|
28
|
+
"admin.typoToleranceEnable": "Włącz tolerowanie literówek",
|
|
29
|
+
"admin.typoToleranceMinWordSizeOneTypo": "Minimalna długość słowa by tolerować jedną literówkę",
|
|
30
|
+
"admin.typoToleranceMinWordSizeTwoTypos": "Minimalna długość słowa by tolerować dwie literówki",
|
|
31
|
+
"admin.typoToleranceDisableOnWords": "Wyłącz tolerowanie literówek dla specyficznych słów",
|
|
32
|
+
"admin.typoToleranceDisableOnWordsHelp": "Meilisearch nie będzie tolerowało literówek dla tych wyrazów. By dowiedzieć się więcej zobacz dokumentację:",
|
|
33
|
+
"admin.typoToleranceDisableOnWordsFormLabel": "Słowo nie tolerujące literówek",
|
|
34
|
+
"admin.addTypoToleranceDisabledWord": "Dodaj słowo nie tolerujące literówek",
|
|
35
|
+
"admin.actions": "Akcje",
|
|
36
|
+
"admin.index": "Indeksowanie",
|
|
37
|
+
"admin.reindex": "Ponownie indeksuj",
|
|
38
|
+
"admin.forceReindex": "Wymuś indeksowanie (usuń wszystkie dokumenty)",
|
|
39
|
+
"admin.reindexHelp": "Ponownie indeksuj wszystkie posty i tematy, w wypadku gdyby dane w Meilisearch nie zgadzały się z NodeBB. Ten proces może zająć dłuższy czas w zależności od ilości postów i tematów na forum.",
|
|
40
|
+
"admin.confirmReindex": "Czy jesteś pewien, że chcesz ponownie indeksować wszystkie posty i tematy?<br>To może zająć trochę czasu",
|
|
41
|
+
"admin.reindexPostsProgress": "Ponowne indeksowanie postów...",
|
|
42
|
+
"admin.reindexTopicsProgress": "Ponowne indeksowanie tematów...",
|
|
43
|
+
"admin.save": "zapisz",
|
|
44
|
+
"admin.edit": "edytuj",
|
|
45
|
+
"admin.delete": "usuń",
|
|
46
|
+
"admin.lastReindex": "Ostatnie indeksowanie",
|
|
47
|
+
"admin.lastReindexDate": "zakończone",
|
|
48
|
+
"admin.lastReindexCounts": "Zaindeksowano",
|
|
49
|
+
"admin.lastReindexSuccess": "Ukończono pomyślnie",
|
|
50
|
+
"admin.lastReindexFailed": "Niepowodzenie",
|
|
51
|
+
"admin.lastReindexStatus": "Status",
|
|
52
|
+
"admin.lastReindexTopics": "Tematy",
|
|
53
|
+
"admin.lastReindexPosts": "Posty",
|
|
54
|
+
"admin.lastReindexError": "Błąd",
|
|
55
|
+
"admin.reindexingCompleted": "Indeksowanie ukończone",
|
|
56
|
+
"admin.reindexingCompletedBody": "Indeksowanie zakończone pomyślnie",
|
|
57
|
+
"admin.settingsSaved": "Ustawienia zapisane",
|
|
58
|
+
"admin.settingsSavedBody": "Twoje ustawienia zostały pomyślnie zapisane.",
|
|
59
|
+
"admin.meiliUnreachable": "MeiliSearch niedostępny",
|
|
60
|
+
"admin.meiliUnreachableBody": "Ustawienia zostały zapisane, ale MeiliSearch jest niedostępny. Ustawienia indeksu zostaną zastosowane po przywróceniu połączenia.",
|
|
61
|
+
"admin.indexingStarted": "Indeksowanie rozpoczęte",
|
|
62
|
+
"admin.indexingStartedBody": "Ponowne indeksowanie działa w tle. Postęp pojawi się poniżej.",
|
|
63
|
+
"similar-topics-header": "Twój temat jest podobny do…",
|
|
64
|
+
"esc": "esc"
|
|
65
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
{
|
|
2
|
+
"admin.settings": "Meilisearch 设置",
|
|
3
|
+
"admin.connection": "连接设置",
|
|
4
|
+
"admin.host": "Meilisearch URL",
|
|
5
|
+
"admin.apiKey": "API Key",
|
|
6
|
+
"admin.healthCheckInterval": "运行状态检查间隔(秒)",
|
|
7
|
+
"admin.search": "搜索选项",
|
|
8
|
+
"admin.maxDocuments": "返回文档的最大数量",
|
|
9
|
+
"admin.searchMinTermLength": "最短搜索词长度",
|
|
10
|
+
"admin.searchMinTermLengthHelp": "若查询中每个词的字符数都小于该值,则跳过搜索。最小为 2。用于规避 NodeBB 在单字符搜索时的高亮显示 bug。",
|
|
11
|
+
"admin.rankingRules": "排序规则",
|
|
12
|
+
"admin.rankingRulesHelp": "为了确保搜索结果的相关性,搜索结果会根据一组连续的规则(称为排序规则)进行排序。如需了解更多信息,请阅读此处的文档:",
|
|
13
|
+
"admin.rankingRulesFormLabel": "规则",
|
|
14
|
+
"admin.rankingRulesFormHelp": "自定义规则使用以下语法: '属性:asc' 或 '属性:desc' ,如:cid:asc。如需了解更多信息,请阅读此处的文档:",
|
|
15
|
+
"admin.addRankingRule": "添加排序规则",
|
|
16
|
+
"admin.stopWords": "停用词",
|
|
17
|
+
"admin.stopWordsHelp": "只有当查询中至少包含一个非停用词时,停用词才会从查询中被移除。如果整个查询全部由停用词组成,Meilisearch 仍会使用该词进行搜索(不会忽略)。有关 Meilisearch 停用词行为的更多信息,请参阅:",
|
|
18
|
+
"admin.stopWordsFormLabel": "停用词",
|
|
19
|
+
"admin.stopWordsFormHelp": "如需了解更多信息,请阅读此处的文档",
|
|
20
|
+
"admin.addStopWord": "添加停用词",
|
|
21
|
+
"admin.synonyms": "同义词",
|
|
22
|
+
"admin.synonymsHelp": "为了使搜索结果更加相关,Meilisearch 应将其视为具有同等含义的词语。如需了解更多信息,请阅读此处的文档:",
|
|
23
|
+
"admin.synonymsWordFormLabel": "词",
|
|
24
|
+
"admin.synonymsSynonymsFormLabel": "同义词",
|
|
25
|
+
"admin.synonymsFormHelp": "以逗号分隔的列表形式添加同义词(如 “单词、语句、短语”)",
|
|
26
|
+
"admin.addSynonym": "添加同义词",
|
|
27
|
+
"admin.typoTolerance": "拼写容错",
|
|
28
|
+
"admin.typoToleranceEnable": "启用拼写容错",
|
|
29
|
+
"admin.typoToleranceMinWordSizeOneTypo": "容忍一个拼写错误的最少字数",
|
|
30
|
+
"admin.typoToleranceMinWordSizeTwoTypos": "容忍两个拼写错误的最少字数",
|
|
31
|
+
"admin.typoToleranceDisableOnWords": "禁用指定单词的拼写容错功能",
|
|
32
|
+
"admin.typoToleranceDisableOnWordsHelp": "仅当搜索查询中精确输入了这些单词之一时,拼写容错才会被禁用;该查询词将不会匹配索引中的拼写变体。注意:搜索禁用词的拼写错误版本仍会通过容错机制匹配正确拼写的文档。如需了解更多信息,请参阅:",
|
|
33
|
+
"admin.typoToleranceDisableOnWordsFormLabel": "禁用拼写容错的单词",
|
|
34
|
+
"admin.addTypoToleranceDisabledWord": "添加禁用拼写容错的单词",
|
|
35
|
+
"admin.actions": "操作",
|
|
36
|
+
"admin.index": "索引",
|
|
37
|
+
"admin.reindex": "重新索引",
|
|
38
|
+
"admin.forceReindex": "强制重新索引(删除所有文档)",
|
|
39
|
+
"admin.reindexHelp": "在 Meilisearch 和 NodeBB 不匹配的情况下,重新索引所有帖子和主题。这可能需要一段时间,具体取决于您论坛中帖子和主题的数量。",
|
|
40
|
+
"admin.confirmReindex": "您确定要开始重新索引所有帖子和主题吗?<br>这项操作可能需要一段时间。",
|
|
41
|
+
"admin.reindexPostsProgress": "重新索引帖子中...",
|
|
42
|
+
"admin.reindexTopicsProgress": "重新索引主题中...",
|
|
43
|
+
"admin.save": "保存",
|
|
44
|
+
"admin.edit": "编辑",
|
|
45
|
+
"admin.delete": "删除",
|
|
46
|
+
"admin.lastReindex": "最近一次重新索引",
|
|
47
|
+
"admin.lastReindexDate": "完成时间",
|
|
48
|
+
"admin.lastReindexCounts": "已索引",
|
|
49
|
+
"admin.lastReindexSuccess": "已成功完成",
|
|
50
|
+
"admin.lastReindexFailed": "失败",
|
|
51
|
+
"admin.lastReindexStatus": "状态",
|
|
52
|
+
"admin.lastReindexTopics": "主题",
|
|
53
|
+
"admin.lastReindexPosts": "帖子",
|
|
54
|
+
"admin.lastReindexError": "错误",
|
|
55
|
+
"admin.reindexingCompleted": "索引完成",
|
|
56
|
+
"admin.reindexingCompletedBody": "重新索引已成功完成",
|
|
57
|
+
"admin.settingsSaved": "设置已保存",
|
|
58
|
+
"admin.settingsSavedBody": "您的设置已成功保存。",
|
|
59
|
+
"admin.meiliUnreachable": "MeiliSearch 不可达",
|
|
60
|
+
"admin.meiliUnreachableBody": "设置已保存,但 MeiliSearch 不可达。索引设置将在连接恢复后应用。",
|
|
61
|
+
"admin.indexingStarted": "索引已开始",
|
|
62
|
+
"admin.indexingStartedBody": "重新索引正在后台运行,进度将显示在下方。",
|
|
63
|
+
"similar-topics-header": "你的主题类似于…",
|
|
64
|
+
"esc": "esc"
|
|
65
|
+
}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
/* Place any LESS in here */
|
|
2
|
+
|
|
3
|
+
.force-reindex-container {
|
|
4
|
+
margin-top: 0;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
.reindex-actions {
|
|
8
|
+
display: flex;
|
|
9
|
+
flex-wrap: wrap;
|
|
10
|
+
align-items: center;
|
|
11
|
+
justify-content: center;
|
|
12
|
+
gap: 1rem;
|
|
13
|
+
width: 100%;
|
|
14
|
+
|
|
15
|
+
#reindex {
|
|
16
|
+
flex: 0 0 auto;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
@media (max-width: @screen-xs-max) {
|
|
20
|
+
.reindex-actions {
|
|
21
|
+
flex-direction: column;
|
|
22
|
+
gap: 0.75rem;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.reindex-progress-container {
|
|
27
|
+
transition: display 0.5s;
|
|
28
|
+
}
|
|
29
|
+
.reindex-progress-bar {
|
|
30
|
+
transition: width 0.1s;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.last-reindex-title {
|
|
34
|
+
margin-top: 0;
|
|
35
|
+
margin-bottom: 8px;
|
|
36
|
+
font-size: 14px;
|
|
37
|
+
font-weight: bold;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.last-reindex-table {
|
|
41
|
+
margin-bottom: 0;
|
|
42
|
+
font-size: 13px;
|
|
43
|
+
|
|
44
|
+
th {
|
|
45
|
+
text-align: right;
|
|
46
|
+
vertical-align: middle;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
th, td {
|
|
50
|
+
word-break: break-word;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.label {
|
|
54
|
+
font-size: 85%;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/* Composer Subject-field quick-search dropdown decorations.
|
|
59
|
+
Activated by static/lib/client/quick-search.js when the dropdown
|
|
60
|
+
belongs to a composer instance (searchOptions.composer === 1). */
|
|
61
|
+
.quick-search-container[data-meilisearch-decorated="1"] {
|
|
62
|
+
position: relative;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.meilisearch-quick-search-header {
|
|
66
|
+
display: flex;
|
|
67
|
+
align-items: center;
|
|
68
|
+
justify-content: space-between;
|
|
69
|
+
padding: 0.25rem 0.5rem;
|
|
70
|
+
margin-bottom: 0.25rem;
|
|
71
|
+
border-bottom: 1px solid var(--bs-border-color, #dee2e6);
|
|
72
|
+
|
|
73
|
+
strong {
|
|
74
|
+
font-size: 0.9rem;
|
|
75
|
+
font-weight: bold;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
.meilisearch-quick-search-esc {
|
|
80
|
+
position: absolute;
|
|
81
|
+
top: 0.35rem;
|
|
82
|
+
right: 0.5rem;
|
|
83
|
+
font-size: 0.7rem;
|
|
84
|
+
letter-spacing: 0.04em;
|
|
85
|
+
text-transform: uppercase;
|
|
86
|
+
padding: 0 0.35rem;
|
|
87
|
+
line-height: 1.4;
|
|
88
|
+
border: 1px solid var(--bs-border-color, #dee2e6);
|
|
89
|
+
border-radius: 0.25rem;
|
|
90
|
+
color: var(--bs-secondary-color, #6c757d);
|
|
91
|
+
background: var(--bs-body-bg, #fff);
|
|
92
|
+
user-select: none;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/* Cap dropdown to roughly 3 result rows so it never overflows past the
|
|
96
|
+
browser bottom bar when the composer is in half-screen mode. Activated
|
|
97
|
+
only on composer dropdowns (data-meilisearch-decorated="1" set by
|
|
98
|
+
static/lib/client/quick-search.js). */
|
|
99
|
+
.quick-search-container[data-meilisearch-decorated="1"] {
|
|
100
|
+
max-height: 320px;
|
|
101
|
+
overflow: hidden;
|
|
102
|
+
display: flex;
|
|
103
|
+
flex-direction: column;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
.quick-search-container[data-meilisearch-decorated="1"] .quick-search-results {
|
|
107
|
+
max-height: 260px !important;
|
|
108
|
+
overflow: auto;
|
|
109
|
+
flex: 1 1 auto;
|
|
110
|
+
}
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
/*
|
|
4
|
+
This file is located in the "modules" block of plugin.json
|
|
5
|
+
It is only loaded when the user navigates to /admin/plugins/meilisearch page
|
|
6
|
+
It is not bundled into the min file that is served on the first load of the page.
|
|
7
|
+
*/
|
|
8
|
+
define('admin/plugins/meilisearch', [
|
|
9
|
+
'settings',
|
|
10
|
+
'api',
|
|
11
|
+
'alerts',
|
|
12
|
+
'modals',
|
|
13
|
+
], (settings, api, alerts, modals) => {
|
|
14
|
+
const ACP = {};
|
|
15
|
+
|
|
16
|
+
function onReindex(data) {
|
|
17
|
+
if (!data || !data.topic_progress || !data.post_progress) {
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
const progressBarContainers = document.querySelectorAll('.reindex-progress-container');
|
|
21
|
+
const hasProgress = data.running ||
|
|
22
|
+
Number(data.topic_progress.total) > 0 || Number(data.post_progress.total) > 0;
|
|
23
|
+
if (data.running || hasProgress) {
|
|
24
|
+
progressBarContainers.forEach((container) => {
|
|
25
|
+
container.classList.remove('hidden');
|
|
26
|
+
});
|
|
27
|
+
const topicProgressBar = document.getElementById('topic-reindex-progress');
|
|
28
|
+
setProgress(topicProgressBar, data.topic_progress.current, data.topic_progress.total);
|
|
29
|
+
const postProgressBar = document.getElementById('post-reindex-progress');
|
|
30
|
+
setProgress(postProgressBar, data.post_progress.current, data.post_progress.total);
|
|
31
|
+
|
|
32
|
+
document.getElementById('topic-reindex-progress-text').innerText =
|
|
33
|
+
`${Number(data.topic_progress.current) || 0}/${Number(data.topic_progress.total) || 0}`;
|
|
34
|
+
document.getElementById('post-reindex-progress-text').innerText =
|
|
35
|
+
`${Number(data.post_progress.current) || 0}/${Number(data.post_progress.total) || 0}`;
|
|
36
|
+
} else {
|
|
37
|
+
progressBarContainers.forEach((container) => {
|
|
38
|
+
container.classList.add('hidden');
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
if (
|
|
42
|
+
!data.running && data.topic_progress.total === data.topic_progress.current &&
|
|
43
|
+
data.post_progress.total === data.post_progress.current
|
|
44
|
+
) {
|
|
45
|
+
alerts.alert({
|
|
46
|
+
title: '[[meilisearch:admin.reindexingCompleted]]',
|
|
47
|
+
message: '[[meilisearch:admin.reindexingCompletedBody]]',
|
|
48
|
+
type: 'success',
|
|
49
|
+
timeout: 5000,
|
|
50
|
+
});
|
|
51
|
+
setTimeout(() => {
|
|
52
|
+
progressBarContainers.forEach((container) => {
|
|
53
|
+
container.classList.add('hidden');
|
|
54
|
+
});
|
|
55
|
+
}, 60000);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
ACP.init = function () {
|
|
60
|
+
app.enterRoom('admin/plugins/meilisearch');
|
|
61
|
+
settings.load('meilisearch', $('.meilisearch-settings'), () => {
|
|
62
|
+
});
|
|
63
|
+
$('#save').on('click', saveSettings);
|
|
64
|
+
$('#reindex').on('click', reindex);
|
|
65
|
+
formatLocalTimes();
|
|
66
|
+
socket.removeListener('plugins.meilisearch.reindex', onReindex);
|
|
67
|
+
socket.on('plugins.meilisearch.reindex', onReindex);
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
function setProgress(element, current, total) {
|
|
71
|
+
current = Number(current) || 0;
|
|
72
|
+
total = Number(total) || 0;
|
|
73
|
+
const pct = total > 0 ? Math.min(100, Math.max(0, Math.round(100 * current / total))) : 0;
|
|
74
|
+
element.innerText = `${current}/${total}`;
|
|
75
|
+
element.setAttribute('aria-valuenow', current);
|
|
76
|
+
element.setAttribute('aria-valuemax', total);
|
|
77
|
+
element.style.width = `${pct}%`;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
function formatLocalTimes() {
|
|
81
|
+
document.querySelectorAll('[data-finished-at]').forEach((el) => {
|
|
82
|
+
const ts = Number(el.getAttribute('data-finished-at'));
|
|
83
|
+
if (Number.isFinite(ts)) {
|
|
84
|
+
el.textContent = new Date(ts).toLocaleString('en-US');
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
function saveSettings() {
|
|
90
|
+
settings.save('meilisearch', $('.meilisearch-settings'), () => {
|
|
91
|
+
alerts.alert({
|
|
92
|
+
type: 'success',
|
|
93
|
+
alert_id: 'meilisearch-saved',
|
|
94
|
+
title: '[[meilisearch:admin.settingsSaved]]',
|
|
95
|
+
message: '[[meilisearch:admin.settingsSavedBody]]',
|
|
96
|
+
timeout: 5000,
|
|
97
|
+
});
|
|
98
|
+
api.get('/plugins/meilisearch/reindex').then((response) => {
|
|
99
|
+
if (response && !response.healthy) {
|
|
100
|
+
alerts.alert({
|
|
101
|
+
type: 'warning',
|
|
102
|
+
alert_id: 'meilisearch-health',
|
|
103
|
+
title: '[[meilisearch:admin.meiliUnreachable]]',
|
|
104
|
+
message: '[[meilisearch:admin.meiliUnreachableBody]]',
|
|
105
|
+
timeout: 10000,
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
}).catch(() => {});
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
function reindex() {
|
|
112
|
+
const forceReindex = document.getElementById('force-reindex').checked;
|
|
113
|
+
modals.confirm('[[meilisearch:admin.confirmReindex]]', (confirm) => {
|
|
114
|
+
if (!confirm) {
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
const request = !forceReindex
|
|
118
|
+
? api.post('/plugins/meilisearch/reindex')
|
|
119
|
+
: api.del('/plugins/meilisearch/reindex');
|
|
120
|
+
request.then(() => {
|
|
121
|
+
alerts.alert({
|
|
122
|
+
type: 'info',
|
|
123
|
+
alert_id: 'meilisearch-reindex-started',
|
|
124
|
+
title: '[[meilisearch:admin.indexingStarted]]',
|
|
125
|
+
message: '[[meilisearch:admin.indexingStartedBody]]',
|
|
126
|
+
timeout: 5000,
|
|
127
|
+
});
|
|
128
|
+
}).catch((err) => {
|
|
129
|
+
alerts.alert({
|
|
130
|
+
type: 'danger',
|
|
131
|
+
alert_id: 'meilisearch-reindex-started',
|
|
132
|
+
title: '[[meilisearch:admin.indexingStarted]]',
|
|
133
|
+
message: err && err.message ? err.message : String(err),
|
|
134
|
+
});
|
|
135
|
+
});
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
return ACP;
|
|
139
|
+
});
|