@@ -23,6 +23,14 @@ declare namespace tei="http://www.tei-c.org/ns/1.0";
2323(: Variables:)
2424declare variable $search:start {request:get-parameter ('start' , 1 ) cast as xs:integer};
2525declare variable $search:perpage {request:get-parameter ('perpage' , 20 ) cast as xs:integer};
26+ declare variable $search:q {request:get-parameter ('q' , '' ) cast as xs:string};
27+ declare variable $search:persName {request:get-parameter ('persName' , '' ) cast as xs:string};
28+ declare variable $search:placeName {request:get-parameter ('placeName' , '' ) cast as xs:string};
29+ declare variable $search:title {request:get-parameter ('title' , '' ) cast as xs:string};
30+ declare variable $search:bibl {request:get-parameter ('bibl' , '' ) cast as xs:string};
31+ declare variable $search:idno {request:get-parameter ('uri' , '' ) cast as xs:string};
32+ declare variable $search:sort-element {request:get-parameter ('sort-element' , '' ) cast as xs:string};
33+ declare variable $search:collection {request:get-parameter ('collection' , '' ) cast as xs:string};
2634
2735(:~
2836 : Builds search result, saves to model("hits") for use in HTML display
@@ -32,7 +40,7 @@ declare variable $search:perpage {request:get-parameter('perpage', 20) cast as x
3240 : Search results stored in map for use by other HTML display functions
3341 data:search($collection)
3442:)
35- declare %templates:wrap function search:search-data ($node as node (), $model as map (*), $collection as xs:string?){
43+ declare %templates:wrap function search:search-data ($node as node (), $model as map (*), $collection as xs:string?, $view as xs:string? ){
3644 let $coll := if ($search:collection != '' ) then $search:collection else $collection
3745 let $keyword-query := data:keyword-search ()
3846 let $eval-string := concat (search:query-string ($collection),facet:facet-filter (global:facet-definition-file ($collection)))
@@ -62,7 +70,7 @@ declare %templates:wrap function search:search-data($node as node(), $model as m
6270 : Builds general search string from main syriaca.org page and search api.
6371:)
6472declare function search:query-string ($collection as xs:string?) as xs:string?{
65- concat ("collection('" ,$global :data-root,"')//tei:TEI" ,
73+ concat ("collection('" ,$config :data-root,"')//tei:TEI" ,
6674 data:keyword-search (),
6775 data:element-search ('author' ,request:get-parameter ('author' , '' )),
6876 data:element-search ('title' ,request:get-parameter ('title' , '' )),
@@ -114,7 +122,7 @@ declare function search:bibl(){
114122 normalize-space ($search:bibl)
115123 else
116124 string-join (distinct-values (
117- for $r in collection ($global :data-root || '/bibl' )//tei:body[ft:query (.,$terms, data:search-options ())]/ancestor::tei:TEI/descendant::tei:publicationStmt/tei:idno[starts-with (.,'http://syriaca.org' )][1 ]
125+ for $r in collection ($config :data-root || '/bibl' )//tei:body[ft:query (.,$terms, data:search-options ())]/ancestor::tei:TEI/descendant::tei:publicationStmt/tei:idno[starts-with (.,'http://syriaca.org' )][1 ]
118126 return concat (substring-before ($r,'/tei' ),'(\s|$)' )),'|' )
119127 return concat ("[descendant::tei:bibl/tei:ptr[@target[matches(.,'" ,$ids,"')]]]" )
120128 else ()
@@ -129,7 +137,7 @@ declare function search:idno(){
129137};
130138
131139declare function search:catalog-limit (){
132- for $r in collection ($global :data-root)//tei:titleStmt/tei:title[@level="s" ]
140+ for $r in collection ($config :data-root)//tei:titleStmt/tei:title[@level="s" ]
133141 group by $group := $r/@ref
134142 order by global:build-sort-string ($r[1 ]/text (),'' )
135143 return <option value = "{concat (';fq-Catalog:' ,$group)} " >{$r[1 ]/text ()}</option>
@@ -161,11 +169,11 @@ function search:show-hits($node as node()*, $model as map(*), $collection as xs:
161169 </div>
162170 <div class = "col-md-9" xml:lang = "en" >
163171 {(tei2html:summary-view ($hit, (), $id[1 ])) }
164- {(:
172+ {
165173 if ($expanded//exist:match) then
166174 tei2html:output-kwic ($expanded, $id)
167175 else ()
168- :) () }
176+ }
169177 </div>
170178 </div>
171179 </div>
@@ -252,6 +260,7 @@ declare function search:build-form($search-config) {
252260 </form>
253261};
254262
263+
255264(:~
256265 : Simple default search form to us if not search-config.xml file is present. Can be customized.
257266:)
@@ -293,30 +302,59 @@ declare function search:default-search-form() {
293302 </div>
294303 </div>
295304 </div>
296- <!-- Title-->
297- <div class = "form-group" >
298- <label for = "title" class = "col-sm-2 col-md-3 control-label" >Title: </label>
299- <div class = "col-sm-10 col-md-9 " >
300- <div class = "input-group" >
301- <input type = "text" id = "title" name = "title" class = "form-control keyboard" />
302- <div class = "input-group-btn" >
303- {global:keyboard-select-menu ('title' )}
304- </div>
305- </div>
306- </div>
305+ <!-- Author-->
306+ <div class = "form-group" >
307+ <label for = "author" class = "col-sm-2 col-md-3 control-label" >Author: </label>
308+ <div class = "col-sm-10 col-md-9 " >
309+ <div class = "input-group" >
310+ <input type = "text" id = "author" name = "author" class = "form-control keyboard" />
311+ <div class = "input-group-btn" >
312+ {global:keyboard-select-menu ('author' )}
313+ </div>
314+ </div>
307315 </div>
308- <!-- Place Name-->
309- <div class = "form-group" >
310- <label for = "placeName" class = "col-sm-2 col-md-3 control-label" >Place Name: </label>
311- <div class = "col-sm-10 col-md-9 " >
312- <div class = "input-group" >
313- <input type = "text" id = "placeName" name = "placeName" class = "form-control keyboard" />
314- <div class = "input-group-btn" >
315- {global:keyboard-select-menu ('placeName' )}
316- </div>
317- </div>
318- </div>
316+ </div>
317+ <div class = "form-group" >
318+ <label for = "title" class = "col-sm-2 col-md-3 control-label" >Title: </label>
319+ <div class = "col-sm-10 col-md-9" >
320+ <div class = "input-group" >
321+ <input type = "text" id = "title" name = "title" class = "form-control keyboard" />
322+ <div class = "input-group-btn" >
323+ {global:keyboard-select-menu ('title' )}
324+ </div>
325+ <div class = "input-group-btn" style = "width:50%;" >
326+ <select name = "fq" class = "form-control" >
327+ <option value = "" > -- Limit by Catalog -- </option>
328+ {search:catalog-limit ()}
329+ </select>
330+ </div>
331+ </div>
332+ </div>
333+ </div>
334+ <div class = "form-group" >
335+ <label for = "section" class = "col-sm-2 col-md-3 control-label" >Section number: </label>
336+ <div class = "col-sm-10 col-md-9 " >
337+ <input type = "text" id = "section" name = "section" class = "form-control" />
338+ </div>
339+ </div>
340+ <div class = "form-group" >
341+ <label for = "corpus-uri" class = "col-sm-2 col-md-3 control-label" >Corpus URI: </label>
342+ <div class = "col-sm-10 col-md-9 " >
343+ <input type = "text" id = "corpus-uri" name = "corpus-uri" class = "form-control" />
344+ </div>
345+ </div>
346+ <div class = "form-group" >
347+ <label for = "syriaca-uri" class = "col-sm-2 col-md-3 control-label" >Syriaca URI: </label>
348+ <div class = "col-sm-10 col-md-9 " >
349+ <input type = "text" id = "syriaca-uri" name = "syriaca-uri" class = "form-control" />
350+ </div>
351+ </div>
352+ <div class = "form-group" >
353+ <label for = "text-id" class = "col-sm-2 col-md-3 control-label" >Text ID Number: </label>
354+ <div class = "col-sm-10 col-md-9 " >
355+ <input type = "text" id = "text-id" name = "text-id" class = "form-control" />
319356 </div>
357+ </div>
320358 <!-- end col -->
321359 </div>
322360 <!-- end row -->
0 commit comments