forked from abaevdict/abaev-basex
implemented full-text search
This commit is contained in:
parent
947fe623da
commit
9b42996cef
6 changed files with 203 additions and 15 deletions
|
@ -85,7 +85,7 @@ declare function api:word-info-long($n as node()) {
|
|||
'refs': array:build(./ref,
|
||||
fn {
|
||||
map:merge((
|
||||
map:entry('node-id', string(./@node-id)),
|
||||
map:entry('path', string(./@path)),
|
||||
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 (only form for now) :)
|
||||
(: Entry info :)
|
||||
declare %rest:path("{$db-lang}/api/entries")
|
||||
%rest:GET
|
||||
function api:entries($db-lang as xs:string) {
|
||||
|
@ -187,4 +187,15 @@ 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
|
Loading…
Add table
Add a link
Reference in a new issue