diff options
author | Munyoki Kilyungi | 2023-10-17 20:23:41 +0300 |
---|---|---|
committer | Munyoki Kilyungi | 2023-10-17 20:23:41 +0300 |
commit | 1eb9f3d74e8d4ad52994ee4dea1ab67f8c8063d3 (patch) | |
tree | adc7473d7cccfc3fe56f1a9394e6c1918d877586 | |
parent | df2e91d1067d797655fbb788b93af6ce71d9ec3e (diff) | |
download | gn-transform-databases-1eb9f3d74e8d4ad52994ee4dea1ab67f8c8063d3.tar.gz |
Index text when loading data.
* load-rdf.scm (bulk-load-data): Remove "quit;". This will be done
after indexing.
(index-data): New function
(main): Add index-data.
Signed-off-by: Munyoki Kilyungi <me@bonfacemunyoki.com>
-rwxr-xr-x | load-rdf.scm | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/load-rdf.scm b/load-rdf.scm index 3b82d55..aaf1b00 100755 --- a/load-rdf.scm +++ b/load-rdf.scm @@ -75,7 +75,6 @@ SET PWD=~s; ld_dir('/var/lib/data', '*.ttl', '~a'); rdf_loader_run(); CHECKPOINT; -quit; " port password @@ -83,6 +82,22 @@ quit; OPEN_WRITE "isql")) +(define (index-data port password) + "Index all text data for quicker search" + (call-with-pipe + (lambda (out) + (format out + "SET DSN=localhost:~a; +SET PWD=~s; +DB.DBA.RDF_OBJ_FT_RULE_ADD (null, null, 'All'); +DB.DBA.VT_INC_INDEX_DB_DBA_RDF_OBJ(); +quit; +" + port + password)) + OPEN_WRITE + "isql")) + (define (time-thunk thunk) "Run THUNK and return the time taken in seconds." (let ((start-time (current-time))) @@ -119,7 +134,14 @@ quit; (cut bulk-load-data (assq-ref connection-settings 'virtuoso-port) (assq-ref connection-settings 'virtuoso-password) - %graph-uri))))) + %graph-uri))) + ;; Index the data + (format (current-output-port) + "Indexing the data" + (time-thunk + (cut index-data + (assq-ref connection-settings 'virtuoso-port) + (assq-ref connection-settings 'virtuoso-password)))))) ((arg0 _ ...) (format (current-error-port) "Usage: ~a CONNECTION-SETTINGS-FILE~%" arg0) (exit #f)))) |