diff --git a/server/core/opds/SearchHelpPage.js b/server/core/opds/SearchHelpPage.js
new file mode 100644
index 0000000..5c71751
--- /dev/null
+++ b/server/core/opds/SearchHelpPage.js
@@ -0,0 +1,59 @@
+const he = require('he');
+
+const BasePage = require('./BasePage');
+
+class SearchHelpPage extends BasePage {
+ constructor(config) {
+ super(config);
+
+ this.id = 'search_help';
+ this.title = 'Памятка по поиску';
+
+ }
+
+ async body(req) {
+ const result = {};
+
+ result.link = this.baseLinks(req, true);
+
+ const content = `
+Формат поискового значения:
+
+ -
+ без префикса: значение трактуется, как "начинается с"
+
+ -
+ префикс "=": поиск по точному совпадению
+
+ -
+ префикс "*": поиск подстроки в строке
+
+ -
+ префикс "#": поиск подстроки в строке, но только среди значений, начинающихся не с латинского или кириллического символа
+
+ -
+ префикс "?": поиск пустых значений или тех, что начинаются с этого символа
+
+
+`;
+ const entry = [
+ this.makeEntry({
+ id: 'help',
+ title: this.title,
+ content: {
+ '*ATTRS': {type: 'text/html'},
+ '*TEXT': he.escape(content),
+ },
+ link: [
+ this.downLink({href: '/book/fake-link', type: `application/fb2+zip`})
+ ],
+ })
+ ];
+
+ result.entry = entry;
+
+ return this.makeBody(result, req);
+ }
+}
+
+module.exports = SearchHelpPage;
\ No newline at end of file
diff --git a/server/core/opds/SearchPage.js b/server/core/opds/SearchPage.js
index a58d62f..93f3616 100644
--- a/server/core/opds/SearchPage.js
+++ b/server/core/opds/SearchPage.js
@@ -38,7 +38,7 @@ class SearchPage extends BasePage {
entry.push(
this.makeEntry({
id: row.id,
- title: `${(from === 'series' ? 'Серия: ': '')}${row[from]}`,
+ title: `${(from === 'series' ? 'Серия: ': '')}${from === 'author' ? this.bookAuthor(row[from]) : row[from]}`,
link: this.navLink({href: `/${from}?${from}==${encodeURIComponent(row[from])}`}),
content: {
'*ATTRS': {type: 'text'},
@@ -88,6 +88,15 @@ class SearchPage extends BasePage {
'*TEXT': `Искать по названиям книг`,
},
}),
+ this.makeEntry({
+ id: 'search_help',
+ title: '[Памятка по поиску]',
+ link: this.acqLink({href: `/search-help`}),
+ content: {
+ '*ATTRS': {type: 'text'},
+ '*TEXT': `Описание формата поискового значения`,
+ },
+ }),
]
}
diff --git a/server/core/opds/index.js b/server/core/opds/index.js
index b2cc556..bbe6895 100644
--- a/server/core/opds/index.js
+++ b/server/core/opds/index.js
@@ -9,6 +9,7 @@ const BookPage = require('./BookPage');
const OpensearchPage = require('./OpensearchPage');
const SearchPage = require('./SearchPage');
+const SearchHelpPage = require('./SearchHelpPage');
module.exports = function(app, config) {
if (!config.opds || !config.opds.enabled)
@@ -26,6 +27,7 @@ module.exports = function(app, config) {
const opensearch = new OpensearchPage(config);
const search = new SearchPage(config);
+ const searchHelp = new SearchHelpPage(config);
const routes = [
['', root],
@@ -38,6 +40,7 @@ module.exports = function(app, config) {
['/opensearch', opensearch],
['/search', search],
+ ['/search-help', searchHelp],
];
const pages = new Map();