Skip to content

Commit

Permalink
first shot at fixing #156
Browse files Browse the repository at this point in the history
  • Loading branch information
peterstadler authored and daniel-jettka committed Dec 2, 2024
1 parent 43de8b8 commit 08fbe59
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 7 deletions.
14 changes: 8 additions & 6 deletions add/data/xql/search.xql
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ xquery version "3.1";
import module namespace kwic = "http://exist-db.org/xquery/kwic";
import module namespace transform="http://exist-db.org/xquery/transform";

import module namespace edition = "http://www.edirom.de/xquery/edition" at "../xqm/edition.xqm";
import module namespace eutil = "http://www.edirom.de/xquery/eutil" at "../xqm/eutil.xqm";

(: NAMESPACE DECLARATIONS ================================================== :)
Expand All @@ -25,6 +26,7 @@ declare option output:media-type "text/html";
(: VARIABLE DECLARATIONS =================================================== :)

declare variable $lang := request:get-parameter('lang', '');
declare variable $edition := request:get-parameter('uri', '');

(: FUNCTION DECLARATIONS =================================================== :)

Expand Down Expand Up @@ -75,12 +77,12 @@ let $return :=

let $search :=
if (string-length($term) gt 0) then (
collection('/db')//tei:text[ft:query(., $term)]/ancestor::tei:TEI
| collection('/db')//tei:title[ft:query(., $term)]/ancestor::tei:TEI
| collection('/db')//mei:mei[ft:query(., $term)]
| collection('/db')//mei:title[ft:query(., $term)]/ancestor::mei:mei
| collection('/db')//mei:annot[ft:query(., $term)][@type eq 'editorialComment']
| collection('/db')//mei:annot[contains(@xml:id, $term)]
edition:collection($edition)//tei:text[ft:query(., $term)]/ancestor::tei:TEI
| edition:collection($edition)//tei:title[ft:query(., $term)]/ancestor::tei:TEI
| edition:collection($edition)//mei:mei[ft:query(., $term)]
| edition:collection($edition)//mei:title[ft:query(., $term)]/ancestor::mei:mei
| edition:collection($edition)//mei:annot[ft:query(., $term)][@type eq 'editorialComment']
| edition:collection($edition)//mei:annot[contains(@xml:id, $term)]
) else
()

Expand Down
8 changes: 8 additions & 0 deletions add/data/xqm/edition.xqm
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,13 @@ module namespace edition = "http://www.edirom.de/xquery/edition";
(: IMPORTS ================================================================= :)

import module namespace functx="http://www.functx.com";
import module namespace eutil = "http://www.edirom.de/xquery/util" at "util.xqm";

(: NAMESPACE DECLARATIONS ================================================== :)

declare namespace edirom = "http://www.edirom.de/ns/1.3";
declare namespace xlink = "http://www.w3.org/1999/xlink";
declare namespace util = "http://exist-db.org/xquery/util";

(: VARIABLE DECLARATIONS =================================================== :)

Expand Down Expand Up @@ -188,3 +190,9 @@ declare function edition:getFrontendUri($editionUri as xs:string, $contextPath a
return
string-join(($contextPath, $editionContext), '/')
};

declare function edition:collection($edition as xs:string?) as document-node()* {
if($edition)
then collection(eutil:getPreference('edition_path', $edition))
else util:log('warn', 'No edition provided')
};
3 changes: 2 additions & 1 deletion app/controller/window/search/SearchWindow.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,8 @@ Ext.define('EdiromOnline.controller.window.search.SearchWindow', {
'GET',
{
term: term,
lang: getPreference('application_language')
lang: getPreference('application_language'),
uri: view.uri
},
Ext.bind(function(response){
me.win.setResult(response.responseText);
Expand Down

0 comments on commit 08fbe59

Please sign in to comment.