aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/doc_reform/io_out/sqlite.d
diff options
context:
space:
mode:
authorRalph Amissah <ralph.amissah@gmail.com>2020-03-29 18:29:44 -0400
committerRalph Amissah <ralph.amissah@gmail.com>2020-05-20 11:27:23 -0400
commiteed0938b23d13ec4f2ef4588ccdb2e7abc0c1552 (patch)
tree4e015ce076795100792412b76156330e80440c37 /src/doc_reform/io_out/sqlite.d
parentmeson using dub (diff)
0.10.0 search sqlite & cgi
Diffstat (limited to 'src/doc_reform/io_out/sqlite.d')
-rw-r--r--src/doc_reform/io_out/sqlite.d56
1 files changed, 32 insertions, 24 deletions
diff --git a/src/doc_reform/io_out/sqlite.d b/src/doc_reform/io_out/sqlite.d
index 1a30204..ce8f688 100644
--- a/src/doc_reform/io_out/sqlite.d
+++ b/src/doc_reform/io_out/sqlite.d
@@ -63,7 +63,7 @@ template SQLiteHubDiscreteBuildTablesAndPopulate() {
const D doc_abstraction,
M doc_matters,
) {
- auto url_html = spineUrlsHTML!()(doc_matters.conf_make_meta.conf.webserv_url_doc_root, doc_matters.src.language);
+ auto url_html = spineUrlsHTML!()(doc_matters.conf_make_meta.conf.w_srv_data_root_url, doc_matters.src.language);
auto pth_sqlite = spinePathsSQLiteDiscrete!()(doc_matters.output_path, doc_matters.src.language);
pth_sqlite.base.mkdirRecurse;
auto db = Database(pth_sqlite.sqlite_file(doc_matters.src.filename));
@@ -261,7 +261,7 @@ template SQLiteFormatAndLoadObject() {
M doc_matters,
const O obj,
string _txt,
- string _suffix = ".html",
+ string _suffix = ".html",
string _xml_type = "seg",
) {
string _img_pth;
@@ -307,7 +307,7 @@ template SQLiteFormatAndLoadObject() {
_txt = _txt.replaceFirst(
rgx.inline_link_hash,
"┥$1┝┤"
- ~ doc_matters.conf_make_meta.conf.webserv_url_doc_root
+ ~ doc_matters.conf_make_meta.conf.w_srv_data_root_url
~ "/"
~ pth_html.tail_fn_seg(doc_matters.src.filename, "$3.html")
~ "├"
@@ -316,7 +316,7 @@ template SQLiteFormatAndLoadObject() {
_txt = _txt.replaceFirst(
rgx.inline_link_hash,
"┥$1┝┤"
- ~ doc_matters.conf_make_meta.conf.webserv_url_doc_root
+ ~ doc_matters.conf_make_meta.conf.w_srv_data_root_url
~ "/"
~ doc_matters.has.tag_associations[(m.captures[3])]["seg_lv4"]
~ ".html"
@@ -341,7 +341,7 @@ template SQLiteFormatAndLoadObject() {
_txt = _txt.replaceFirst(
rgx.inline_link_hash,
"┥$1┝┤"
- ~ doc_matters.conf_make_meta.conf.webserv_url_doc_root
+ ~ doc_matters.conf_make_meta.conf.w_srv_data_root_url
~ "/"
~ pth_html.tail_fn_scroll(doc_matters.src.filename)
~ "#" ~ "$3"
@@ -865,8 +865,8 @@ template SQLiteTablesReCreate() {
DROP INDEX IF EXISTS idx_digest_all;
DROP INDEX IF EXISTS idx_clean;
DROP INDEX IF EXISTS idx_title;
- DROP INDEX IF EXISTS idx_creator_author;
- DROP INDEX IF EXISTS src_filename;
+ DROP INDEX IF EXISTS idx_author;
+ DROP INDEX IF EXISTS src_filename_base;
DROP INDEX IF EXISTS idx_language_document_char;
DROP INDEX IF EXISTS idx_classify_topic_register;
DROP TABLE IF EXISTS metadata_and_text;
@@ -885,6 +885,7 @@ template SQLiteTablesReCreate() {
title_language VARCHAR(100) NULL,
title_language_char VARCHAR(6) NULL,
creator_author VARCHAR(600) NOT NULL,
+ creator_author_last_first VARCHAR(600) NOT NULL,
creator_author_email VARCHAR(100) NULL,
creator_author_hon VARCHAR(100) NULL,
creator_author_nationality VARCHAR(100) NULL,
@@ -947,7 +948,8 @@ template SQLiteTablesReCreate() {
notes_prefix_b TEXT NULL,
notes_suffix TEXT NULL,
publisher VARCHAR(600) NULL,
- src_filename VARCHAR(256) NOT NULL,
+ src_filename_base VARCHAR(256) NOT NULL,
+ src_filename_suffix VARCHAR(6) NOT NULL,
src_fingerprint VARCHAR(256) NULL,
src_filesize VARCHAR(10) NULL,
src_wordcount VARCHAR(10) NULL,
@@ -991,7 +993,7 @@ template SQLiteTablesReCreate() {
last_decendant VARCHAR(16) NULL, -- headings only
digest_clean CHAR(256),
digest_all CHAR(256),
- html_seg_url CHAR(256),
+ seg_name CHAR(256),
types CHAR(1) NULL
);
CREATE INDEX idx_ocn ON doc_objects(ocn);
@@ -999,9 +1001,9 @@ template SQLiteTablesReCreate() {
CREATE INDEX idx_digest_all ON doc_objects(digest_all);
CREATE INDEX idx_clean ON doc_objects(clean);
CREATE INDEX idx_title ON metadata_and_text(title);
- CREATE INDEX idx_author ON metadata_and_text(creator_author);
+ CREATE INDEX idx_author ON metadata_and_text(creator_author_last_first);
CREATE INDEX idx_uid ON metadata_and_text(uid);
- CREATE INDEX idx_filename ON metadata_and_text(src_filename);
+ CREATE INDEX idx_filename ON metadata_and_text(src_filename_base);
CREATE INDEX idx_language ON metadata_and_text(language_document_char);
CREATE INDEX idx_topics ON metadata_and_text(classify_topic_register);
┃",);
@@ -1033,7 +1035,8 @@ template SQLiteInsertMetadata() {
string _insert_metadata = format(q"┃
INSERT INTO metadata_and_text (
uid,
- src_filename,
+ src_filename_base,
+ src_filename_suffix,
src_composite_id_per_txt,
src_composite_id_per_pod,
title,
@@ -1043,6 +1046,7 @@ template SQLiteInsertMetadata() {
title_edition,
title_language,
creator_author,
+ creator_author_last_first,
creator_author_email,
creator_illustrator,
creator_translator,
@@ -1082,11 +1086,12 @@ template SQLiteInsertMetadata() {
site_url_doc_root
)
VALUES (
- '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s'
+ '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s'
);
┃",
_uid,
- SQLinsertDelimiter!()(doc_matters.src.filename),
+ SQLinsertDelimiter!()(doc_matters.src.filename_base),
+ SQLinsertDelimiter!()(doc_matters.src.filename_extension),
SQLinsertDelimiter!()(doc_matters.src.docname_composite_unique_per_src_doc),
SQLinsertDelimiter!()(doc_matters.src.docname_composite_unique_per_src_pod),
SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.title_full),
@@ -1096,6 +1101,7 @@ template SQLiteInsertMetadata() {
SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.title_edition),
SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.title_language),
SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.creator_author),
+ SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.creator_author_surname_fn),
SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.creator_author_email),
SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.creator_illustrator),
SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.creator_translator),
@@ -1132,7 +1138,7 @@ template SQLiteInsertMetadata() {
SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.original_language_char),
SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.original_source),
SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.publisher),
- SQLinsertDelimiter!()(doc_matters.conf_make_meta.conf.webserv_url_doc_root)
+ SQLinsertDelimiter!()(doc_matters.conf_make_meta.conf.w_srv_data_root_url)
);
if (doc_matters.conf_make_meta.meta.classify_topic_register_arr.length > 0) {
@@ -1170,7 +1176,7 @@ template SQLiteInsertDocObjectsLoop() {
M doc_matters,
) {
string _uid = SQLinsertDelimiter!()(doc_matters.src.doc_uid);
- auto url_html = spineUrlsHTML!()(doc_matters.conf_make_meta.conf.webserv_url_doc_root, doc_matters.src.language);
+ auto url_html = spineUrlsHTML!()(doc_matters.conf_make_meta.conf.w_srv_data_root_url, doc_matters.src.language);
string insertDocObjectsRow(O)(O obj) {
string _insert_doc_objects_row = format(q"┃
INSERT INTO doc_objects (
@@ -1182,7 +1188,7 @@ template SQLiteInsertDocObjectsLoop() {
lev,
is_of_type,
is_a,
- html_seg_url
+ seg_name
)
VALUES (
'%s', %s, '%s', '%s', '%s', %s, '%s', '%s', '%s'
@@ -1196,7 +1202,7 @@ template SQLiteInsertDocObjectsLoop() {
obj.metainfo.heading_lev_markup,
obj.metainfo.is_of_type,
obj.metainfo.is_a,
- url_html.fn_seg_obj_num(doc_matters.src.filename, obj.tags.html_segment_anchor_tag_is, obj.metainfo.identifier),
+ obj.tags.html_segment_anchor_tag_is
);
return _insert_doc_objects_row;
}
@@ -1390,8 +1396,8 @@ template SQLiteTablesCreate() {
DROP INDEX IF EXISTS idx_digest_all;
DROP INDEX IF EXISTS idx_clean;
DROP INDEX IF EXISTS idx_title;
- DROP INDEX IF EXISTS idx_creator_author;
- DROP INDEX IF EXISTS src_filename;
+ DROP INDEX IF EXISTS idx_author;
+ DROP INDEX IF EXISTS src_filename_base;
DROP INDEX IF EXISTS idx_language_document_char;
DROP INDEX IF EXISTS idx_classify_topic_register;
DROP TABLE IF EXISTS metadata_and_text;
@@ -1410,6 +1416,7 @@ template SQLiteTablesCreate() {
title_language VARCHAR(100) NULL,
title_language_char VARCHAR(6) NULL,
creator_author VARCHAR(600) NOT NULL,
+ creator_author_last_first VARCHAR(600) NOT NULL,
creator_author_email VARCHAR(100) NULL,
creator_author_hon VARCHAR(100) NULL,
creator_author_nationality VARCHAR(100) NULL,
@@ -1472,7 +1479,8 @@ template SQLiteTablesCreate() {
notes_prefix_b TEXT NULL,
notes_suffix TEXT NULL,
publisher VARCHAR(600) NULL,
- src_filename VARCHAR(256) NOT NULL,
+ src_filename_base VARCHAR(256) NOT NULL,
+ src_filename_suffix VARCHAR(6) NOT NULL,
src_fingerprint VARCHAR(256) NULL,
src_filesize VARCHAR(10) NULL,
src_wordcount VARCHAR(10) NULL,
@@ -1516,7 +1524,7 @@ template SQLiteTablesCreate() {
last_decendant VARCHAR(16) NULL, -- headings only
digest_clean CHAR(256),
digest_all CHAR(256),
- html_seg_url CHAR(256),
+ seg_name CHAR(256),
types CHAR(1) NULL
);
CREATE INDEX idx_ocn ON doc_objects(ocn);
@@ -1524,9 +1532,9 @@ template SQLiteTablesCreate() {
CREATE INDEX idx_digest_all ON doc_objects(digest_all);
CREATE INDEX idx_clean ON doc_objects(clean);
CREATE INDEX idx_title ON metadata_and_text(title);
- CREATE INDEX idx_author ON metadata_and_text(creator_author);
+ CREATE INDEX idx_author ON metadata_and_text(creator_author_last_first);
CREATE INDEX idx_uid ON metadata_and_text(uid);
- CREATE INDEX idx_filename ON metadata_and_text(src_filename);
+ CREATE INDEX idx_filename ON metadata_and_text(src_filename_base);
CREATE INDEX idx_language ON metadata_and_text(language_document_char);
CREATE INDEX idx_topics ON metadata_and_text(classify_topic_register);
┃",);