aboutsummaryrefslogtreecommitdiffhomepage
path: root/sundry/spine_search_cgi/src
diff options
context:
space:
mode:
authorRalph Amissah <ralph.amissah@gmail.com>2022-01-28 10:38:10 -0500
committerRalph Amissah <ralph.amissah@gmail.com>2022-01-29 00:50:49 -0500
commitd39da3f07036b22892ffb0b05737e8ba7e1ff954 (patch)
tree7d4a5cca9563faa1f9f15057b2ad0116149775b3 /sundry/spine_search_cgi/src
parentcgi sqlite_search, heading matches fix, cleanup (diff)
config & sqlite search output, some changes
Diffstat (limited to 'sundry/spine_search_cgi/src')
-rw-r--r--sundry/spine_search_cgi/src/spine_search.d63
-rwxr-xr-xsundry/spine_search_cgi/src/spine_search.d_63
2 files changed, 108 insertions, 18 deletions
diff --git a/sundry/spine_search_cgi/src/spine_search.d b/sundry/spine_search_cgi/src/spine_search.d
index e1e0c93..07a824d 100644
--- a/sundry/spine_search_cgi/src/spine_search.d
+++ b/sundry/spine_search_cgi/src/spine_search.d
@@ -82,7 +82,7 @@ void cgi_function_intro(Cgi cgi) {
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.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=\""
@@ -1681,6 +1681,7 @@ SELECT
doc_objects.seg_name,
doc_objects.ocn,
doc_objects.lev,
+ doc_objects.is_a,
metadata_and_text.uid
FROM
doc_objects,
@@ -1748,8 +1749,19 @@ LIMIT %s OFFSET %s
);
}
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\">"
@@ -1757,9 +1769,10 @@ LIMIT %s OFFSET %s
~ 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\">"
@@ -1768,6 +1781,16 @@ LIMIT %s OFFSET %s
~ "</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\">"
@@ -1776,9 +1799,9 @@ LIMIT %s OFFSET %s
~ 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\">"
@@ -1788,20 +1811,42 @@ LIMIT %s OFFSET %s
);
}
} 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=\""
@@ -1809,9 +1854,9 @@ LIMIT %s OFFSET %s
~ 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>, "
);
}
diff --git a/sundry/spine_search_cgi/src/spine_search.d_ b/sundry/spine_search_cgi/src/spine_search.d_
index 3703659..3c9a738 100755
--- a/sundry/spine_search_cgi/src/spine_search.d_
+++ b/sundry/spine_search_cgi/src/spine_search.d_
@@ -84,7 +84,7 @@ void cgi_function_intro(Cgi cgi) {
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=\""
@@ -1683,6 +1683,7 @@ SELECT
doc_objects.seg_name,
doc_objects.ocn,
doc_objects.lev,
+ doc_objects.is_a,
metadata_and_text.uid
FROM
doc_objects,
@@ -1750,8 +1751,19 @@ LIMIT %s OFFSET %s
);
}
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\">"
@@ -1759,9 +1771,10 @@ LIMIT %s OFFSET %s
~ 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\">"
@@ -1770,6 +1783,16 @@ LIMIT %s OFFSET %s
~ "</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\">"
@@ -1778,9 +1801,9 @@ LIMIT %s OFFSET %s
~ 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\">"
@@ -1790,20 +1813,42 @@ LIMIT %s OFFSET %s
);
}
} 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=\""
@@ -1811,9 +1856,9 @@ LIMIT %s OFFSET %s
~ 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>, "
);
}