summaryrefslogtreecommitdiffhomepage
path: root/README
blob: 0db6faf2743068f4462fc026272cfd870f0b2494 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
-*- mode: org -*-
#+TITLE:       spine (sisudoc) (project) README
#+DESCRIPTION: README for spine search
#+FILETAGS:    :spine:build:tools:
#+AUTHOR:      Ralph Amissah
#+EMAIL:       [[mailto:ralph.amissah@gmail.com][ralph.amissah@gmail.com]]
#+COPYRIGHT:   Copyright (C) 2015 - 2024 Ralph Amissah
#+LANGUAGE:    en
#+STARTUP:     content hideblocks hidestars noindent entitiespretty
#+OPTIONS:     H:3 num:nil toc:t \n:nil @:t ::t |:t ^:nil _:nil -:t f:t *:t <:t
#+PROPERTY:    header-args  :exports code
#+PROPERTY:    header-args+ :noweb yes
#+PROPERTY:    header-args+ :eval no
#+PROPERTY:    header-args+ :results no
#+PROPERTY:    header-args+ :cache no
#+PROPERTY:    header-args+ :padline no

project_name: "sisudoc-spine-search"

description:
  - "documents, structuring, processing, publishing"
  - "search"
  - "object numbering"
  - "cgi search form for static content generator"
  - "sisu markup"

author:
  name:  "Ralph Amissah"
  email: ralph.amissah@gmail.com

copyright: "(C) 2015 - 2024 Ralph Amissah, All Rights Reserved."

license:
  - "project code: AGPL 3 or later"

homepage:
  - "https://sisudoc.org"
  - "https://doc-reform.org"

git:
  - "https://git.sisudoc.org"

* Summary

This is a sample cgi search form for access to an sqlite3 db built and populated
by sisudoc-spine. As such you probably need the whold of the sisudoc.org spine
project.

SiSU is an object-centric, lightweight markup based, document structuring,
parser, publishing and search tool for document collections. It is command line
oriented and generates static content that is currently made searchable at an
object level through an SQL database. Markup helps define (delineate) objects
(primarily various types of text block) which are tracked in sequence,
substantive objects being numbered sequentially by the program for object
citation.

Development of sisudoc-spine started in 2015 on a Debian linux box as a
replacement for sisu (written in Ruby, starting 2000, and Perl from 1997).
(Using Nix and NixOS since 2020).

* Build Configuration

sisudoc-spine-search-cgi example form is served from a web-server that has been
configured for cgi. To get this example to work, you will need to edit the file
in ./views/configuration.txt to match the configuration of your web-server and
in particular: the the web server url; the name of the cgi script and; the name
and location of the sqlite database. The following is an example
./views/configuration.txt file.

struct Cfg {
  string http_request_type     = "http";
  string http_host             = "localhost";
  string www_url_doc_subroot   = "/spine";
  string cgi_filename          = "spine_search";
  string cgi_search_form_title = "≅ SiSU Spine search ፨";
  string db_sqlite_path        = "/var/www/sqlite";
  string db_sqlite_filename    = "spine.search.db";
}
enum _cfg = Cfg();

* Compilation, Installation
** D compiler (dmd, ldc2) & D build manager (dub)

SiSU spine is written in the programming language D for which there are 3
compilers: dmd, ldc, gdc
- https://wiki.dlang.org/Compilers

D projects tend to use dub as project manager
- https://code.dlang.org/packages/dub
- https://github.com/dlang/dub/blob/master/source/dub/commandline.d

The default build tools used are dub with ldc2 (dub is also tested)

** make a directory & clone the sisudoc-spine project

Make a directory and clone the sisudoc-spine project (or just sisudoc-spine-
search-cgi as needed)

Make a directory and clone the sisudoc-spine project

  mkdir ~/git.sisudoc
  cd ~/git.sisudoc

  git clone git://git.sisudoc.org/software/sisudoc-spine && \
  git clone git://git.sisudoc.org/software/sisudoc-spine-search-cgi && \
  git clone git://git.sisudoc.org/markup/sisudoc-spine-samples

such a relative directory layout will be assumed in the examples that provided

all work in this installation of sisudoc-spine-search-cgi will take place in the
directory: sisudoc-spine-search-cgi

** build sisudoc-spine

NOTE all actions to build sisudoc-spine are taken within the directory
sisudoc-spine-search-cgi

cd sisudoc-spine-search-cgi

NOTE:
- if dub is used to build, the resulting binary should be located in ./bin:
- if "nix build" is used the resulting binary should be in ./result/bin

cd sisudoc-spine

*** build using nix flakes on linux (binary in ./result/bin)

you need to have nix installed on your system, and to have nix flakes enabled,
on Debian for example, you would do the following:

sudo apt install nix

create the file in the given path & filename: ~/.config/nix/nix.conf
with the following content: experimental-features = flakes nix-command

which can be achieved thusly:

mkdir -p ~/.config/nix && echo "experimental-features = flakes nix-command" >> ~/.config/nix/nix.conf

- to use the D compiler ldc2:

  nix build ".#spine-search-nixpkgs-ldc" --print-build-logs
  # or
  nix build ".#spine-search-overlay-ldc" --print-build-logs

- to use the D compiler dmd:

  nix build ".#spine-search-nixpkgs-dmd" --print-build-logs
  # or
  nix build ".#spine-search-overlay-dmd" --print-build-logs

*** build using dub directly (binary in ./bin)

- to use the D compiler ldc2:
  # on nix (get dependencies by setting your development environment):
  nix develop ".#dsh-nixpkgs-ldc-dub" --print-build-logs -c zsh

  # assuming you have ldc2 & dub installed on your system:
  dub run --compiler=ldmd2 --config=ldmd2 --combined --skip-registry=all
  or
  dub run --compiler=ldc2 --config=ldc2 --combined --skip-registry=all

- to use the D compiler dmd:
  # on nix (get dependencies by setting your development environment):
  nix develop ".#dsh-nixpkgs-dmd-dub" --print-build-logs -c zsh

  # assuming you have dmd & dub installed on your system:
  dub run --compiler=dmd --config=dmd --combined --skip-registry=all

* Commands

For commands to populate the db to be searched by sisudoc-spine-search-cgi see
the README in sisudoc-spine and/or sisudoc-spine-samples

However, a number of command instructions provided will not work unless the
sqlite db has been initialised and like the web content, this the sqlite databse
will not be found by sisudoc-spine-search-cgi unless it is placed where the
web-server is configured to find it.