From 1eb9f3d74e8d4ad52994ee4dea1ab67f8c8063d3 Mon Sep 17 00:00:00 2001 From: Munyoki Kilyungi Date: Tue, 17 Oct 2023 20:23:41 +0300 Subject: 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 --- load-rdf.scm | 26 ++++++++++++++++++++++++-- 1 file 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)))) -- cgit v1.2.3