module namespace search = 'http://ossetic-studies.org/ns/abaevdict-site/search'; 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'; declare variable $search:types := ( { 'query': ".//text() contains text {'$'}", 'ru': 'Везде', 'en': 'All' }, { 'query': ".//tei:form/tei:orth//text() contains text {'$'}", 'ru': 'Формы', 'en': 'Forms' }, { 'query': ".//tei:cit[@type='translationEquivalent']//text() contains text {'$'}", 'ru': 'Значения', 'en': 'Meanings' }, { 'query': ".//tei:cit[@type='example']/tei:quote//text() contains text {'$'}", 'ru': 'Примеры', 'en': 'Examples' }, { 'query': ".//tei:cit[@type='translation']//text() contains text {'$'}", 'ru': 'Переводы', 'en': 'Translations' }, { 'query': ".//tei:mentioned/(tei:m|tei:w|tei:phr|tei:s)/text() contains text {'$'}", 'ru': 'Цит. формы', 'en': 'Mentioned' }, { 'query': ".//tei:gloss//text() contains text {'$'}", 'ru': 'Глоссы', 'en': 'Glosses' }, { 'query': "./tei:etym[1]//text() contains text {'$'}", 'ru': 'Этимологии', 'en': 'Etymology' }, { 'query': "$", 'ru': 'XQuery', 'en': 'XQuery' } ); (: GET SEARCH RESULTS :) declare function search:content($lang as xs:string, $pattern as xs:string? := (), $text as xs:string? := ()) {
,{if ($lang = 'ru') then 'Лексема' else 'Lemma'} | {if ($lang = 'ru') then 'Перевод' else 'Translation'} | {if ($lang = 'ru') then 'Контекст' else 'Context'} |
---|---|---|
{$hit/tei:form[1]/tei:orth[1]} | { string-join( data($hit/tei:sense /(tei:sense|tei:sense/tei:sense|.)/tei:cit/tei:quote), ', ' ) } | { if (count($hit//*[tei:mark]) > 0) then util:strip-namespaces(($hit//*[tei:mark])[1])/child::node() } |