Skip to content

Commit

Permalink
Merge pull request #117 from Edirom/issue-112
Browse files Browse the repository at this point in the history
fix filtering of "Collection" and "Keywords" ("Search term") on the main list view
  • Loading branch information
AnastasiaWawilow authored Oct 13, 2022
2 parents e1d8bb2 + 4bbdf4f commit 3d98efa
Show file tree
Hide file tree
Showing 4 changed files with 67 additions and 63 deletions.
59 changes: 29 additions & 30 deletions modules/list_files.xq
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,35 @@ declare function local:format-reference(
<td class="label">Filter by: &#160;</td>
<td class="label">Publication status</td>
<td class="label">Collection</td>
<td class="label">Keywords</td>
<td class="label">Search term <a class="help">?<span class="comment">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:<br/>
<span class="help_table">
<span class="help_example">
<span class="help_label">carl OR nielsen</span>
<span class="help_value">Boolean OR (default)</span>
</span>
<span class="help_example">
<span class="help_label">carl AND nielsen</span>
<span class="help_value">Boolean AND</span>
</span>
<span class="help_example">
<span class="help_label">"carl nielsen"</span>
<span class="help_value">Exact phrase</span>
</span>
<span class="help_example">
<span class="help_label">niels*</span>
<span class="help_value">Match any number of characters. Finds Niels, Nielsen and Nielsson<br/>
(use only at end of word)
</span>
</span>
<span class="help_example">
<span class="help_label">niels?n</span>
<span class="help_value">Match 1 character. Finds Nielsen and Nielson, but not Nielsson</span>
</span>
</span>
</span>
</a></td>
</tr>
<tr>
<td>&#160;</td>
Expand Down Expand Up @@ -217,35 +245,6 @@ declare function local:format-reference(
<input name="query" value='{session:get-attribute("query")}'/>
<input type="submit" value="Search" />
<input type="submit" value="Clear" onclick="this.form.query.value='';this.form.submit();return true;"/>
<a class="help">?<span class="comment">Search terms may be combined using boolean operators. Wildcards allowed.
Search is case insensitive (except for boolean operators, which must be uppercase).
Some examples:<br/>
<span class="help_table">
<span class="help_example">
<span class="help_label">carl OR nielsen</span>
<span class="help_value">Boolean OR (default)</span>
</span>
<span class="help_example">
<span class="help_label">carl AND nielsen</span>
<span class="help_value">Boolean AND</span>
</span>
<span class="help_example">
<span class="help_label">"carl nielsen"</span>
<span class="help_value">Exact phrase</span>
</span>
<span class="help_example">
<span class="help_label">niels*</span>
<span class="help_value">Match any number of characters. Finds Niels, Nielsen and Nielsson<br/>
(use only at end of word)
</span>
</span>
<span class="help_example">
<span class="help_label">niels?n</span>
<span class="help_value">Match 1 character. Finds Nielsen and Nielson, but not Nielsson</span>
</span>
</span>
</span>
</a>
</form>
</td>
</tr>
Expand Down
38 changes: 38 additions & 0 deletions post-install.xql
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand All @@ -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()
)
Expand Down
32 changes: 0 additions & 32 deletions pre-install.xql

This file was deleted.

1 change: 0 additions & 1 deletion repo.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,5 @@
<copyright>true</copyright>
<type>application</type>
<target>mermeid</target>
<prepare>pre-install.xql</prepare>
<finish>post-install.xql</finish>
</meta>

0 comments on commit 3d98efa

Please sign in to comment.