aboutsummaryrefslogtreecommitdiffhomepage
path: root/org/cgi_spine_search.org
diff options
context:
space:
mode:
authorRalph Amissah <ralph.amissah@gmail.com>2022-01-27 12:57:13 -0500
committerRalph Amissah <ralph.amissah@gmail.com>2022-01-27 18:53:06 -0500
commit1e04f9f2ecb5a326ded1422cd03ee1f37198e571 (patch)
tree02e7fb7f9e61e480365a9b08896ffd9e8019662f /org/cgi_spine_search.org
parentdoc presentation, add option to include date with title and author (diff)
cgi sqlite_search, heading matches fix, cleanup
Diffstat (limited to 'org/cgi_spine_search.org')
-rw-r--r--org/cgi_spine_search.org50
1 files changed, 20 insertions, 30 deletions
diff --git a/org/cgi_spine_search.org b/org/cgi_spine_search.org
index 1fecaa9..b1e9a5a 100644
--- a/org/cgi_spine_search.org
+++ b/org/cgi_spine_search.org
@@ -253,9 +253,7 @@ struct Config {
string http_request_type;
string http_host;
// string server_name;
- string web_doc_root_path;
- string doc_collection_sub_root;
- string cgi_root;
+ string doc_collection_subroot;
string cgi_script_name;
string cgi_search_form_title;
string cgi_search_form_html_title;
@@ -276,9 +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.web_doc_root_path = environment.get("DOCUMENT_ROOT", _cfg.www_doc_root);
-conf.doc_collection_sub_root = "<<doc_subroot_path>>"; // (output_path - web_doc_root_path)
-conf.cgi_root = environment.get("CONTEXT_DOCUMENT_ROOT", _cfg.cgi_bin_subpath);
+conf.doc_collection_subroot = _cfg.www_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=\""
@@ -287,7 +283,7 @@ conf.cgi_search_form_html_title = "<a href=\""
~ "\">"
~ _cfg.cgi_search_form_title
~ "</a>";
-conf.query_base_url = conf.http_request_type ~ "://" ~ conf.http_host ~ "/" ~ conf.cgi_script_name ~ "?";
+conf.query_base_url = conf.http_request_type ~ "://" ~ conf.http_host ~ conf.cgi_script_name ~ "?";
conf.query_string = environment.get("QUERY_STRING", "");
conf.http_url = environment.get("HTTP_REFERER", conf.query_base_url ~ conf.query_string);
conf.request_method = environment.get("REQUEST_METHOD", "POST");
@@ -1093,6 +1089,7 @@ SELECT
doc_objects.body,
doc_objects.seg_name,
doc_objects.ocn,
+ doc_objects.lev,
metadata_and_text.uid
FROM
doc_objects,
@@ -1149,7 +1146,7 @@ if (!select_query_results.empty) {
~ "<hr><div class=\"publication\">"
~ "<p class=\"publication\"><a href=\""
~ conf.http_request_type ~ "://"
- ~ conf.http_host ~ conf.doc_collection_sub_root ~ "/"
+ ~ conf.http_host ~ conf.doc_collection_subroot ~ "/"
~ row["language_document_char"].as!string ~ "/html/"
~ row["src_filename_base"].as!string ~ "/"
~ "toc.html"
@@ -1166,16 +1163,16 @@ if (!select_query_results.empty) {
);
}
if (cv.results_type == "txt") {
- if (row["ocn"].as!string != "0") {
+ if ((row["lev"].as!int < 4)
+ || (row["ocn"].as!string == "0")) {
cgi.write(
"<div class=\"flex-container\">"
~ "<div class=\"textview_ocn\" style=\"flex: 0 0 1.2em\">"
~ "<p class=\"ocn_is\"><a href=\""
~ conf.http_request_type ~ "://"
- ~ conf.http_host ~ conf.doc_collection_sub_root ~ "/"
+ ~ 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
+ ~ row["src_filename_base"].as!string ~ "/toc.html"
~ "\">"
~ row["ocn"].as!string
~ "</a>:</p>"
@@ -1191,9 +1188,10 @@ if (!select_query_results.empty) {
~ "<div class=\"textview_ocn\" style=\"flex: 0 0 1.2em\">"
~ "<p class=\"ocn_is\"><a href=\""
~ conf.http_request_type ~ "://"
- ~ conf.http_host ~ conf.doc_collection_sub_root ~ "/"
+ ~ 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 ~ "/"
+ ~ row["seg_name"].as!string ~ ".html#" ~ row["ocn"].as!string
~ "\">"
~ row["ocn"].as!string
~ "</a>:</p>"
@@ -1205,15 +1203,15 @@ if (!select_query_results.empty) {
);
}
} else {
- if (row["ocn"].as!string != "0") {
+ if ((row["lev"].as!int < 4)
+ || (row["ocn"].as!string == "0")) {
cgi.write(
_matched_ocn_open
~ "<a href=\""
~ conf.http_request_type ~ "://"
- ~ conf.http_host ~ conf.doc_collection_sub_root ~ "/"
+ ~ 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
+ ~ row["src_filename_base"].as!string ~ "/toc.html"
~ "\">"
~ row["ocn"].as!string
~ "</a>, "
@@ -1223,9 +1221,10 @@ if (!select_query_results.empty) {
_matched_ocn_open
~ "<a href=\""
~ conf.http_request_type ~ "://"
- ~ conf.http_host ~ conf.doc_collection_sub_root ~ "/"
+ ~ 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 ~ "/"
+ ~ row["seg_name"].as!string ~ ".html#" ~ row["ocn"].as!string
~ "\">"
~ row["ocn"].as!string
~ "</a>, "
@@ -2090,15 +2089,7 @@ _cfg.doc_root_www
#+NAME: doc_subroot_path
#+BEGIN_SRC text
-/spine/static
-#+END_SRC
-
-#+NAME: cgi_root_path
-#+BEGIN_SRC text
-_cfg.doc_root_cgi
-#+END_SRC
-#+BEGIN_SRC text
-/usr/lib/cgi-bin/
+/spine
#+END_SRC
#+NAME: db_root_path
@@ -2168,4 +2159,3 @@ see configuration_cfte.org
+/
#+END_SRC
-