aboutsummaryrefslogtreecommitdiffhomepage
path: root/org/cgi_spine_search.org
diff options
context:
space:
mode:
Diffstat (limited to 'org/cgi_spine_search.org')
-rw-r--r--org/cgi_spine_search.org63
1 files changed, 54 insertions, 9 deletions
diff --git a/org/cgi_spine_search.org b/org/cgi_spine_search.org
index b1e9a5a..311b497 100644
--- a/org/cgi_spine_search.org
+++ b/org/cgi_spine_search.org
@@ -274,7 +274,7 @@ auto conf = Config();
conf.http_request_type = environment.get("REQUEST_SCHEME", _cfg.http_request_type);
conf.http_host = environment.get("SERVER_NAME", _cfg.http_host);
// conf.http_host = environment.get("HTTP_HOST", _cfg.http_host);
-conf.doc_collection_subroot = _cfg.www_doc_subroot;
+conf.doc_collection_subroot = _cfg.www_url_doc_subroot;
conf.cgi_script_name = environment.get("SCRIPT_NAME", _cfg.cgi_filename);
conf.cgi_search_form_title = _cfg.cgi_search_form_title; // ≅ SiSU spine search form
conf.cgi_search_form_html_title = "<a href=\""
@@ -1090,6 +1090,7 @@ SELECT
doc_objects.seg_name,
doc_objects.ocn,
doc_objects.lev,
+ doc_objects.is_a,
metadata_and_text.uid
FROM
doc_objects,
@@ -1163,8 +1164,19 @@ if (!select_query_results.empty) {
);
}
if (cv.results_type == "txt") {
+ string _sfn, _id;
if ((row["lev"].as!int < 4)
|| (row["ocn"].as!string == "0")) {
+ if (row["is_a"].as!string == "bookindex") {
+ _sfn = "bookindex";
+ _id = "idx";
+ } else if (row["is_a"].as!string == "blurb") {
+ _sfn = "blurb";
+ _id = "bm";
+ } else {
+ _sfn = "toc";
+ _id = row["ocn"].as!string;
+ }
cgi.write(
"<div class=\"flex-container\">"
~ "<div class=\"textview_ocn\" style=\"flex: 0 0 1.2em\">"
@@ -1172,9 +1184,10 @@ if (!select_query_results.empty) {
~ conf.http_request_type ~ "://"
~ conf.http_host ~ conf.doc_collection_subroot ~ "/"
~ row["language_document_char"].as!string ~ "/html/"
- ~ row["src_filename_base"].as!string ~ "/toc.html"
+ ~ row["src_filename_base"].as!string ~ "/"
+ ~ _sfn ~ ".html"
~ "\">"
- ~ row["ocn"].as!string
+ ~ _id
~ "</a>:</p>"
~ "</div>"
~ "<div class=\"textview_found\">"
@@ -1183,6 +1196,16 @@ if (!select_query_results.empty) {
~ "</div>"
);
} else {
+ if (row["is_a"].as!string == "bibliography") {
+ _id = row["ocn"].as!string ~ "b";
+ _sfn = "bibliography";
+ } else if (row["is_a"].as!string == "glossary") {
+ _id = row["ocn"].as!string ~ "g";
+ _sfn = "glossary";
+ } else {
+ _id = row["ocn"].as!string;
+ _sfn = row["seg_name"].as!string;
+ }
cgi.write(
"<div class=\"flex-container\">"
~ "<div class=\"textview_ocn\" style=\"flex: 0 0 1.2em\">"
@@ -1191,9 +1214,9 @@ if (!select_query_results.empty) {
~ conf.http_host ~ conf.doc_collection_subroot ~ "/"
~ row["language_document_char"].as!string ~ "/html/"
~ row["src_filename_base"].as!string ~ "/"
- ~ row["seg_name"].as!string ~ ".html#" ~ row["ocn"].as!string
+ ~ _sfn ~ ".html#" ~ row["ocn"].as!string
~ "\">"
- ~ row["ocn"].as!string
+ ~ _id
~ "</a>:</p>"
~ "</div>"
~ "<div class=\"textview_found\">"
@@ -1203,20 +1226,42 @@ if (!select_query_results.empty) {
);
}
} else {
+ string _sfn, _id;
if ((row["lev"].as!int < 4)
|| (row["ocn"].as!string == "0")) {
+ if (row["is_a"].as!string == "bookindex") {
+ _sfn = "bookindex";
+ _id = "i";
+ } else if (row["is_a"].as!string == "blurb") {
+ _sfn = "blurb";
+ _id = "bm";
+ } else {
+ _sfn = "toc";
+ _id = row["ocn"].as!string;
+ }
cgi.write(
_matched_ocn_open
~ "<a href=\""
~ conf.http_request_type ~ "://"
~ conf.http_host ~ conf.doc_collection_subroot ~ "/"
~ row["language_document_char"].as!string ~ "/html/"
- ~ row["src_filename_base"].as!string ~ "/toc.html"
+ ~ row["src_filename_base"].as!string ~ "/"
+ ~ _sfn ~ ".html"
~ "\">"
- ~ row["ocn"].as!string
+ ~ _id
~ "</a>, "
);
} else {
+ if (row["is_a"].as!string == "bibliography") {
+ _id = row["ocn"].as!string ~ "b";
+ _sfn = "bibliography";
+ } else if (row["is_a"].as!string == "glossary") {
+ _id = row["ocn"].as!string ~ "g";
+ _sfn = "glossary";
+ } else {
+ _id = row["ocn"].as!string;
+ _sfn = row["seg_name"].as!string;
+ }
cgi.write(
_matched_ocn_open
~ "<a href=\""
@@ -1224,9 +1269,9 @@ if (!select_query_results.empty) {
~ conf.http_host ~ conf.doc_collection_subroot ~ "/"
~ row["language_document_char"].as!string ~ "/html/"
~ row["src_filename_base"].as!string ~ "/"
- ~ row["seg_name"].as!string ~ ".html#" ~ row["ocn"].as!string
+ ~ _sfn ~ ".html#" ~ row["ocn"].as!string
~ "\">"
- ~ row["ocn"].as!string
+ ~ _id
~ "</a>, "
);
}