fix search paging
This commit is contained in:
parent
6e7cf5a3f1
commit
b89645a5cc
3 changed files with 21 additions and 10 deletions
|
@ -186,15 +186,14 @@ declare %rest:path("{$lang}/search/new")
|
||||||
$sd(1)('entry_id'),
|
$sd(1)('entry_id'),
|
||||||
string-join($sd(1)('path')?*,"|"))
|
string-join($sd(1)('path')?*,"|"))
|
||||||
else
|
else
|
||||||
let $r5 := session:set('searchN',0)
|
web:redirect('../search/clear')
|
||||||
return web:redirect('../dict')
|
|
||||||
};
|
};
|
||||||
|
|
||||||
declare %rest:path("{$lang}/search/next")
|
declare %rest:path("{$lang}/search/next")
|
||||||
%output:method("html")
|
%output:method("html")
|
||||||
%output:html-version('5')
|
%output:html-version('5')
|
||||||
function page:search-next($lang) {
|
function page:search-next($lang) {
|
||||||
let $n := session:get('searchN')+1
|
let $n as xs:integer := session:get('searchN')+1
|
||||||
let $r1 := session:set('searchN', $n)
|
let $r1 := session:set('searchN', $n)
|
||||||
let $sd := session:get('searchData')
|
let $sd := session:get('searchData')
|
||||||
return page:by-id($lang, $sd($n)('entry_id'), string-join($sd($n)('path')?*,"|"))
|
return page:by-id($lang, $sd($n)('entry_id'), string-join($sd($n)('path')?*,"|"))
|
||||||
|
@ -204,7 +203,7 @@ declare %rest:path("{$lang}/search/prev")
|
||||||
%output:method("html")
|
%output:method("html")
|
||||||
%output:html-version('5')
|
%output:html-version('5')
|
||||||
function page:search-prev($lang) {
|
function page:search-prev($lang) {
|
||||||
let $n := session:get('searchN')-1
|
let $n as xs:integer := session:get('searchN')-1
|
||||||
let $r1 := session:set('searchN', $n)
|
let $r1 := session:set('searchN', $n)
|
||||||
let $sd := session:get('searchData')
|
let $sd := session:get('searchData')
|
||||||
return page:by-id($lang, $sd($n)('entry_id'), string-join($sd($n)('path')?*,"|"))
|
return page:by-id($lang, $sd($n)('entry_id'), string-join($sd($n)('path')?*,"|"))
|
||||||
|
@ -214,7 +213,7 @@ declare %rest:path("{$lang}/search/position")
|
||||||
%rest:query-param("p", "{$p}")
|
%rest:query-param("p", "{$p}")
|
||||||
%output:method("html")
|
%output:method("html")
|
||||||
%output:html-version('5')
|
%output:html-version('5')
|
||||||
function page:search-position($lang,$p) {
|
function page:search-position($lang, $p as xs:integer) {
|
||||||
let $r1 := session:set('searchN', $p)
|
let $r1 := session:set('searchN', $p)
|
||||||
let $sd := session:get('searchData')
|
let $sd := session:get('searchData')
|
||||||
return page:by-id($lang, $sd($p)('entry_id'), string-join($sd($p)('path')?*,"|"))
|
return page:by-id($lang, $sd($p)('entry_id'), string-join($sd($p)('path')?*,"|"))
|
||||||
|
|
20
xq/test.xq
20
xq/test.xq
|
@ -3,8 +3,22 @@ declare namespace abv = "http://ossetic-studies.org/ns/abaevdict";
|
||||||
|
|
||||||
import module namespace abv-m = 'http://ossetic-studies.org/ns/abaevdict-mod' at './abv-mod.xqm';
|
import module namespace abv-m = 'http://ossetic-studies.org/ns/abaevdict-mod' at './abv-mod.xqm';
|
||||||
|
|
||||||
let $doc := db:get('abaevdict_en','/xml/entry_az.xml')
|
for $a in [1,2,3]?*
|
||||||
return string(abv-m:make-html($doc, 'ru')/article[1]/@id)
|
return $a
|
||||||
|
|
||||||
|
(: let $doc-tr := $doc transform with {
|
||||||
|
replace node xquery:eval("/Q{http://www.tei-c.org/ns/1.0}entry[1]/Q{http://www.tei-c.org/ns/1.0}etym[1]/Q{http://www.tei-c.org/ns/1.0}mentioned[2]/Q{http://www.tei-c.org/ns/1.0}mentioned[18]", {'': .})
|
||||||
|
with <abv:mark>{xquery:eval("/Q{http://www.tei-c.org/ns/1.0}entry[1]/Q{http://www.tei-c.org/ns/1.0}etym[1]/Q{http://www.tei-c.org/ns/1.0}mentioned[2]/Q{http://www.tei-c.org/ns/1.0}mentioned[18]", {'': .})}</abv:mark>
|
||||||
|
}
|
||||||
|
return $doc :)
|
||||||
|
|
||||||
|
(: array{for $doc in collection('abaevdict_en/xml')
|
||||||
|
let $hits := for $node in $doc//text()
|
||||||
|
where $node contains text 'friend'
|
||||||
|
return path($node)
|
||||||
|
where count($hits) > 0
|
||||||
|
return {'entry_id': string($doc/tei:entry[1]/@xml:id), 'xpath': array{$hits}}} :)
|
||||||
|
|
||||||
(: let $nid := db:node-id($doc/tei:entry[1]/tei:note[1]) :)
|
(: let $nid := db:node-id($doc/tei:entry[1]/tei:note[1]) :)
|
||||||
(: return $nid :)
|
(: return $nid :)
|
||||||
(: return xquery:eval('declare namespace tei = "http://www.tei-c.org/ns/1.0";//tei:note',{'': $doc}) :)
|
(: return xquery:eval('declare namespace tei = "http://www.tei-c.org/ns/1.0";//tei:note',{'': $doc}) :)
|
||||||
|
@ -15,8 +29,6 @@ return string(abv-m:make-html($doc, 'ru')/article[1]/@id)
|
||||||
|
|
||||||
(: import module namespace api = 'http://ossetic-studies.org/ns/abaevdict-api' at './restx_api.xq'; :)
|
(: import module namespace api = 'http://ossetic-studies.org/ns/abaevdict-api' at './restx_api.xq'; :)
|
||||||
|
|
||||||
(: abv-m:make-html(doc('abaevdict_en/xml/entry_az.xml')//tei:mentioned,'en') :)
|
|
||||||
|
|
||||||
(: abv-m:langname-by-id('inc-x-old-vaidika','en') :)
|
(: abv-m:langname-by-id('inc-x-old-vaidika','en') :)
|
||||||
|
|
||||||
(: SERIALIZE AS JSONML :)
|
(: SERIALIZE AS JSONML :)
|
||||||
|
|
|
@ -38,7 +38,7 @@
|
||||||
<!-- The completeness attribute is to be used without namespace, to simplify styling.
|
<!-- The completeness attribute is to be used without namespace, to simplify styling.
|
||||||
For the purposes of conversion, delete it at present -->
|
For the purposes of conversion, delete it at present -->
|
||||||
|
|
||||||
<xsl:template match="@abv:completeness | @abv:status">
|
<xsl:template match="@abv:completeness | @abv:status | @abv:mentionedType">
|
||||||
<!--<xsl:attribute name="completeness">
|
<!--<xsl:attribute name="completeness">
|
||||||
<xsl:value-of select="."/>
|
<xsl:value-of select="."/>
|
||||||
</xsl:attribute>-->
|
</xsl:attribute>-->
|
||||||
|
|
Loading…
Add table
Reference in a new issue