From 3f43f879b310a08efb70a45a414d2339e93f362c Mon Sep 17 00:00:00 2001 From: Peter Stadler Date: Fri, 19 Aug 2022 09:30:16 +0200 Subject: [PATCH 1/2] move index configuration into post-install hook because we need to know the location of `$config:data-root` --- post-install.xql | 38 ++++++++++++++++++++++++++++++++++++++ pre-install.xql | 32 -------------------------------- repo.xml | 1 - 3 files changed, 38 insertions(+), 33 deletions(-) delete mode 100755 pre-install.xql diff --git a/post-install.xql b/post-install.xql index c03957f2..c943f039 100644 --- a/post-install.xql +++ b/post-install.xql @@ -99,6 +99,43 @@ declare function local:force-xml-mime-type-xbl() as xs:string* { return if (exists($doc)) then xdb:store($forms-includes, $r, $doc, 'application/xml') else () }; +(:~ + : Helper function to recursively create a collection hierarchy. + :) +declare function local:mkcol-recursive($collection, $components) { + if (exists($components)) then + let $newColl := concat($collection, "/", $components[1]) + return ( + xdb:create-collection($collection, $components[1]), + local:mkcol-recursive($newColl, subsequence($components, 2)) + ) + else + () +}; + +(:~ + : Helper function to recursively create a collection hierarchy. + :) +declare function local:mkcol($collection, $path) { + local:mkcol-recursive($collection, tokenize($path, "/")) +}; + +(:~ + : Add default index configuration to the data collection provided in $config:data-root + : Indices are used for searching and filtering on the main list page, + : see https://github.com/Edirom/MerMEId/issues/112 + :) +declare function local:add-index-configuration() as item()* { + let $config-path := concat("/db/system/config", $config:data-root) + return + if(doc-available(concat($config-path, '/collection.xconf'))) then () + else ( + local:mkcol("/db/system/config", $config:data-root), + xdb:store-files-from-pattern($config-path, $dir, "*.xconf"), + xdb:reindex($config:data-root) + ) +}; + (: set options provided as environment variables :) local:set-options(), local:force-xml-mime-type-xbl(), @@ -107,6 +144,7 @@ if (local:first-run()) then local:create-group(), local:create-user(), local:change-group(), + local:add-index-configuration(), (: This has to be the last command otherwise the other commands will not be executed properly :) local:set-admin-password() ) diff --git a/pre-install.xql b/pre-install.xql deleted file mode 100755 index 898eacc7..00000000 --- a/pre-install.xql +++ /dev/null @@ -1,32 +0,0 @@ -xquery version "1.0"; - -import module namespace xdb="http://exist-db.org/xquery/xmldb"; - -(: The following external variables are set by the repo:deploy function :) - -(: file path pointing to the exist installation directory :) -declare variable $home external; -(: path to the directory containing the unpacked .xar package :) -declare variable $dir external; -(: the target collection into which the app is deployed :) -declare variable $target external; - -declare function local:mkcol-recursive($collection, $components) { - if (exists($components)) then - let $newColl := concat($collection, "/", $components[1]) - return ( - xdb:create-collection($collection, $components[1]), - local:mkcol-recursive($newColl, subsequence($components, 2)) - ) - else - () -}; - -(: Helper function to recursively create a collection hierarchy. :) -declare function local:mkcol($collection, $path) { - local:mkcol-recursive($collection, tokenize($path, "/")) -}; - -(: store the collection configuration :) -local:mkcol("/db/system/config", $target), -xdb:store-files-from-pattern(concat("/db/system/config", $target), $dir, "*.xconf") \ No newline at end of file diff --git a/repo.xml b/repo.xml index 1b6efef0..68ac248d 100755 --- a/repo.xml +++ b/repo.xml @@ -9,6 +9,5 @@ true application mermeid - pre-install.xql post-install.xql From 4bbdf4f9bf94bd5a11a0c4f94df132de77b82abd Mon Sep 17 00:00:00 2001 From: Peter Stadler Date: Fri, 19 Aug 2022 10:33:07 +0200 Subject: [PATCH 2/2] move help icon to the appropriate label and relabel the input from "keywords" to "search term" as discussed with @daniel-jettka and @AnastasiaWawilow --- modules/list_files.xq | 59 +++++++++++++++++++++---------------------- 1 file changed, 29 insertions(+), 30 deletions(-) diff --git a/modules/list_files.xq b/modules/list_files.xq index b37f8495..baa09519 100755 --- a/modules/list_files.xq +++ b/modules/list_files.xq @@ -171,7 +171,35 @@ declare function local:format-reference( Filter by:   Publication status Collection - Keywords + Search term ?Search terms may be combined using boolean operators. Wildcards allowed. + Search is case insensitive (except for boolean operators, which must be uppercase) and will query the whole document. + Some examples:
+ + + carl OR nielsen + Boolean OR (default) + + + carl AND nielsen + Boolean AND + + + "carl nielsen" + Exact phrase + + + niels* + Match any number of characters. Finds Niels, Nielsen and Nielsson
+ (use only at end of word) +
+
+ + niels?n + Match 1 character. Finds Nielsen and Nielson, but not Nielsson + +
+
+
  @@ -217,35 +245,6 @@ declare function local:format-reference( - ?Search terms may be combined using boolean operators. Wildcards allowed. - Search is case insensitive (except for boolean operators, which must be uppercase). - Some examples:
- - - carl OR nielsen - Boolean OR (default) - - - carl AND nielsen - Boolean AND - - - "carl nielsen" - Exact phrase - - - niels* - Match any number of characters. Finds Niels, Nielsen and Nielsson
- (use only at end of word) -
-
- - niels?n - Match 1 character. Finds Nielsen and Nielson, but not Nielsson - -
-
-