From 41286959b256b1821cc572a6cea35f9115595cd3 Mon Sep 17 00:00:00 2001 From: Eike Kettner Date: Thu, 25 Jun 2020 23:56:44 +0200 Subject: [PATCH] Updating nix modules with new config options --- nix/module-joex.nix | 88 ++++++++++++++++++++++++++++++++++++++++++- nix/module-server.nix | 80 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 167 insertions(+), 1 deletion(-) diff --git a/nix/module-joex.nix b/nix/module-joex.nix index 3b1d6f1e..3f22ad7f 100644 --- a/nix/module-joex.nix +++ b/nix/module-joex.nix @@ -35,7 +35,7 @@ let scheduler = { pool-size = 2; counting-scheme = "4,1"; - retries = 5; + retries = 2; retry-delay = "1 minute"; log-buffer-size = 500; wakeup-period = "30 minutes"; @@ -133,6 +133,19 @@ let chunk-size = 524288; valid-mime-types = []; }; + full-text-search = { + enabled = false; + solr = { + url = "http://localhost:8983/solr/docspell"; + commit-within = 1000; + log-verbose = false; + def-type = "lucene"; + q-op = "OR"; + }; + migration = { + index-all-chunk = 10; + }; + }; }; in { @@ -860,6 +873,79 @@ in { default = defaults.files; description= "Settings for how files are stored."; }; + full-text-search = mkOption { + type = types.submodule({ + options = { + enabled = mkOption { + type = types.bool; + default = defaults.full-text-search.enabled; + description = '' + The full-text search feature can be disabled. It requires an + additional index server which needs additional memory and disk + space. It can be enabled later any time. + + Currently the SOLR search platform is supported. + ''; + }; + solr = mkOption { + type = types.submodule({ + options = { + url = mkOption { + type = types.str; + default = defaults.full-text-search.solr.url; + description = "The URL to solr"; + }; + commit-within = mkOption { + type = types.int; + default = defaults.full-text-search.solr.commit-within; + description = "Used to tell solr when to commit the data"; + }; + log-verbose = mkOption { + type = types.bool; + default = defaults.full-text-search.solr.log-verbose; + description = "If true, logs request and response bodies"; + }; + def-type = mkOption { + type = types.str; + default = defaults.full-text-search.solr.def-type; + description = '' + The defType parameter to lucene that defines the parser to + use. You might want to try "edismax" or look here: + https://lucene.apache.org/solr/guide/8_4/query-syntax-and-parsing.html#query-syntax-and-parsing + ''; + }; + q-op = mkOption { + type = types.str; + default = defaults.full-text-search.solr.q-op; + description = "The default combiner for tokens. One of {AND, OR}."; + }; + }; + }); + default = defaults.full-text-search.solr; + description = "Configuration for the SOLR backend."; + }; + migration = mkOption { + type = types.submodule({ + options = { + index-all-chunk = mkOption { + type = types.int; + default = defaults.full-text-search.migration.index-all-chunk; + description = '' + Chunk size to use when indexing data from the database. This + many attachments are loaded into memory and pushed to the + full-text index. + ''; + }; + }; + }); + default = defaults.full-text-search.migration; + description = "Settings for running the index migration tasks"; + }; + }; + }); + default = defaults.full-text-search; + description = "Configuration for full-text search."; + }; }; }; diff --git a/nix/module-server.nix b/nix/module-server.nix index 6c40a7ae..e713b508 100644 --- a/nix/module-server.nix +++ b/nix/module-server.nix @@ -37,6 +37,17 @@ let header-value = "some-secret"; }; }; + full-text-search = { + enabled = false; + solr = { + url = "http://localhost:8983/solr/docspell"; + commit-within = 1000; + log-verbose = false; + def-type = "lucene"; + q-op = "OR"; + }; + recreate-key = ""; + }; auth = { server-secret = "hex:caffee"; session-valid = "5 minutes"; @@ -271,6 +282,75 @@ in { ''; }; + full-text-search = mkOption { + type = types.submodule({ + options = { + enabled = mkOption { + type = types.bool; + default = defaults.full-text-search.enabled; + description = '' + The full-text search feature can be disabled. It requires an + additional index server which needs additional memory and disk + space. It can be enabled later any time. + + Currently the SOLR search platform is supported. + ''; + }; + solr = mkOption { + type = types.submodule({ + options = { + url = mkOption { + type = types.str; + default = defaults.full-text-search.solr.url; + description = "The URL to solr"; + }; + commit-within = mkOption { + type = types.int; + default = defaults.full-text-search.solr.commit-within; + description = "Used to tell solr when to commit the data"; + }; + log-verbose = mkOption { + type = types.bool; + default = defaults.full-text-search.solr.log-verbose; + description = "If true, logs request and response bodies"; + }; + def-type = mkOption { + type = types.str; + default = defaults.full-text-search.solr.def-type; + description = '' + The defType parameter to lucene that defines the parser to + use. You might want to try "edismax" or look here: + https://lucene.apache.org/solr/guide/8_4/query-syntax-and-parsing.html#query-syntax-and-parsing + ''; + }; + q-op = mkOption { + type = types.str; + default = defaults.full-text-search.solr.q-op; + description = "The default combiner for tokens. One of {AND, OR}."; + }; + }; + }); + default = defaults.full-text-search.solr; + description = "Configuration for the SOLR backend."; + }; + recreate-key = mkOption { + type = types.str; + default = defaults.full-text-search.recreate-key; + description = '' + When re-creating the complete index via a REST call, this key + is required. If left empty (the default), recreating the index + is disabled. + + Example curl command: + curl -XPOST http://localhost:7880/api/v1/open/fts/reIndexAll/test123 + ''; + }; + }; + }); + default = defaults.full-text-search; + description = "Configuration for full-text search."; + }; + backend = mkOption { type = types.submodule({ options = {