Commit 8d6deb98 authored by Ubbo Veentjer's avatar Ubbo Veentjer
Browse files

selectable search index

parent 19eb4731
......@@ -46,6 +46,25 @@ function fsearch:results($node as node(), $model as map(*)) as map()* {
}
};
declare
function fsearch:searchquery($node as node(), $model as map(*)) {
let $query := request:get-parameter("q", ())
return <input type="text" value="{$query}" name="q" class="form-control" />
};
declare
%templates:wrap
function fsearch:choose-index($node as node(), $model as map(*)) {
let $selected := request:get-parameter("index", "default")
for $index in ("fontane", "default" )
return
if ($index eq $selected) then
<option selected="selected">{$index}</option>
else
<option>{$index}</option>
};
declare
%templates:wrap
function fsearch:hitcount($node as node(), $model as map(*)) {
......@@ -269,12 +288,13 @@ declare function local:deselected-for-key($model, $key as xs:string) {
declare function local:get-hits($model as map(*), $target as xs:string) as node()*{
let $query := request:get-parameter("q", ())
let $index := request:get-parameter("index", "default")
let $fxquery := local:construct-facet-query($model)
let $xqueries := for $query-root in $model("config")//module[@key="faceted-search"]/param[@key="query-root"]//xpath
return
if($query) then
"collection($target)" || $query-root || $fxquery || "[ft:query(., $query)]"
"collection($target)" || $query-root || $fxquery || "[ft:query-field($index, $query)]"
else
"collection($target)" || $query-root || $fxquery
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment