diff --git a/scripts/update-indices.bxs b/scripts/update-indices.bxs index b44d0b9..c04a571 100644 --- a/scripts/update-indices.bxs +++ b/scripts/update-indices.bxs @@ -22,7 +22,7 @@ OPTIMIZE ALL CLOSE # Create mentioned indices -RUN ../xq/put-mentioned-index.xq +RUN ../xq/gen-mentioned-index.xq # Optimize the index database OPEN abaevdict_index diff --git a/static/abaev-html.css b/static/abaev-html.css index 59721b0..3de1717 100644 --- a/static/abaev-html.css +++ b/static/abaev-html.css @@ -89,11 +89,7 @@ body>header>nav, body>footer>nav { margin: auto; --pico-primary: #8D0B02 !important; - --pico-primary-background: #8D0B02 !important; - --pico-primary-border: #8D0B02 !important; --pico-primary-hover: #cd5c5c !important; - --pico-primary-hover-background: #cd5c5c !important; - --pico-primary-hover-border: #cd5c5c !important; } body>header>nav { border-bottom-width: thin; @@ -309,21 +305,6 @@ legend {} form {} -header form { - margin-bottom: 0 !important; -} - -header form button { - padding-left: 1em !important; - padding-right: 1em !important; - padding-top: 0 !important; - padding-bottom: 0 !important; -} - -header form select { - max-width:35%; -} - label {} ::placeholder {} diff --git a/static/abaev-index.js b/static/abaev-index.js index 03b7e5e..3fcb9a7 100644 --- a/static/abaev-index.js +++ b/static/abaev-index.js @@ -45,7 +45,7 @@ $( document ).ready(function() { if(glosses.length > 0) { entrystring = `${glosses.join('; ')}: ` } - opt = $(``); $select_entry.append(opt) }) @@ -57,8 +57,7 @@ $( document ).ready(function() { $('#abv-select-entry').on("dblclick", function() { let $selected = $(this).children('option:selected'); - let entry = $selected.attr('value'); - let path = $selected.attr('data-abv-xpath'); - window.location.replace('./dict/' + entry + `?entry=${entry}&xpath=${path}`); + let $entry = $selected.attr('value'); + window.location.replace('./dict/' + $entry); }); }); diff --git a/xq/abv-mod.xqm b/xq/abv-mod.xqm index e38ce14..21b1f9e 100644 --- a/xq/abv-mod.xqm +++ b/xq/abv-mod.xqm @@ -267,40 +267,4 @@ declare function abv-m:langname-by-id($id as xs:string, $lang as xs:string) { declare function abv-m:entry-form-by-id($id as xs:string) { doc(`abaevdict_index/lookup.xml`)/tei:table[1]/tei:entry[@xml:id=$id]/text() -}; - -declare function abv-m:mark-element($doc as document-node(), $path as xs:string) { - let $doc-tr := $doc transform with { - for $n in xquery:eval($path, {'': .}) - return replace node $n - with {$n} - } - return $doc-tr -}; - -(: Function to search, used in API and elsewhere :) -declare function abv-m:search($db-lang as xs:string, - $type as xs:string, - $query as xs:string) { - let $pexpr := string-join( - ('declare namespace tei = "http://www.tei-c.org/ns/1.0";', - switch($type) - case "full" return "//text()" - case "form" return "/tei:entry[1]/tei:form/tei:orth" - case "sense" return "/tei:entry[1]/tei:sense" - case "example" return "/tei:entry[1]//tei:cit[@type='example']/tei:quote" - case "translation" return "/tei:entry[1]//tei:cit[@type='translation']" - case "mentioned" return "/tei:entry[1]//tei:mentioned/(tei:m|tei:w|tei:phr|tei:s)" - case "gloss" return "tei:entry[1]//tei:gloss" - case "etym" return "tei:entry[1]/tei:etym[1]//text()" - default return "//text()") - ) - return array{for $doc in collection(`abaevdict_{$db-lang}/xml`) - let $hits := for $node in xquery:eval($pexpr, {'': $doc}) - where $node contains text {$query} - return path($node) - where count($hits) > 0 - order by abv-m:sortKey($doc/tei:entry[1]/tei:form[1]/tei:orth[1]) - return {'entry_id': string($doc/tei:entry[1]/@xml:id), - 'path': array:build($hits)}} - }; \ No newline at end of file +}; \ No newline at end of file diff --git a/xq/gen-mentioned-index.xq b/xq/gen-mentioned-index.xq index 7b733b0..af3d0e9 100644 --- a/xq/gen-mentioned-index.xq +++ b/xq/gen-mentioned-index.xq @@ -18,7 +18,7 @@ as map(xs:string, map(xs:string, map(xs:string, item()*)))* { for $w in $ment/tei:w/text() return map{$w : map{$id : map {'gloss': local:get-gloss($ment), - 'node': path($ment) } + 'node': db:node-id($ment) } } } }; @@ -98,7 +98,7 @@ return { for $ref in $words($w)($e) return - + { for $g in $ref('gloss') return diff --git a/xq/restx_api.xq b/xq/restx_api.xq index 5f75851..90cc9d5 100644 --- a/xq/restx_api.xq +++ b/xq/restx_api.xq @@ -85,7 +85,7 @@ declare function api:word-info-long($n as node()) { 'refs': array:build(./ref, fn { map:merge(( - map:entry('path', string(./@path)), + map:entry('node-id', string(./@node-id)), if(./gloss) then {'glosses': array:build(distinct-values(./gloss/@text), string#1)} else () @@ -168,7 +168,7 @@ declare %rest:path("{$db-lang}/api/languages/{$lang}/words/{$word-id}") ) }; -(: Entry info :) +(: Entry info (only form for now) :) declare %rest:path("{$db-lang}/api/entries") %rest:GET function api:entries($db-lang as xs:string) { @@ -187,15 +187,4 @@ declare %rest:path("{$db-lang}/api/entries/{$entry-id}") $db-lang) }; -(: Search API :) -declare %rest:path("{$db-lang}/api/search") - %rest:query-param("type","{$type}",'full') - %rest:query-param("query","{$query}") - %rest:GET - function api:search($db-lang as xs:string, - $type as xs:string, - $query as xs:string) { - abv-m:search($db-lang,$type,$query) - }; - 0 \ No newline at end of file diff --git a/xq/restx_dict_cached.xq b/xq/restx_dict_cached.xq index 9166f15..db84ff6 100644 --- a/xq/restx_dict_cached.xq +++ b/xq/restx_dict_cached.xq @@ -4,7 +4,6 @@ declare namespace tei = "http://www.tei-c.org/ns/1.0"; import module namespace abv-m = 'http://ossetic-studies.org/ns/abaevdict-mod' at './abv-mod.xqm'; - (: =========================================================== :) (: ================== GLOBAL VARIABLES ======================= :) (: =========================================================== :) @@ -50,7 +49,7 @@ declare function page:header($lang as xs:string, $href-other as xs:string) { { switch($lang) case 'ru' return 'ИЭСОЯ В. И. Абаева' - default return `Abaevdict` + default return 'Abaevdict' } β
  • { (element {if ($lang = 'ru') then 'mark' else 'a'}{ @@ -69,59 +68,6 @@ declare function page:header($lang as xs:string, $href-other as xs:string) {