You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -329,3 +348,50 @@ declare function search:search-form() {
329
348
</div>
330
349
</form>
331
350
};
351
+
352
+
(: e-gedsh search functions :)
353
+
declarefunctionsearch:strip-chars($string){
354
+
let $query-string := $string
355
+
let $query-string :=
356
+
if (functx:number-of-matches($query-string, '"') mod2) then
357
+
replace($query-string, '"', ' ')
358
+
else $query-string (:if there is an uneven number of quotation marks, delete all quotation marks.:)
359
+
let $query-string :=
360
+
if ((functx:number-of-matches($query-string, '\(') + functx:number-of-matches($query-string, '\)')) mod2eq0)
361
+
then $query-string
362
+
elsetranslate($query-string, '()', ' ') (:if there is an uneven number of parentheses, delete all parentheses.:)
363
+
let $query-string :=
364
+
if ((functx:number-of-matches($query-string, '\[') + functx:number-of-matches($query-string, '\]')) mod2eq0)
365
+
then $query-string
366
+
elsetranslate($query-string, '[]', ' ') (:if there is an uneven number of brackets, delete all brackets.:)
367
+
let $query-string := replace($string,"'","''")
368
+
return
369
+
if(matches($query-string,"(^\*$)|(^\?$)")) then'Invalid Search String, please try again.'(: Must enter some text with wildcard searches:)
370
+
elsereplace(replace($query-string,'<|>|@',''), '(\.|\[|\]|\\|\||\-|\^|\$|\+|\{|\}|\(|\)|(/))','\\$1') (: Escape special characters. Fixes error, but does not return correct results on URIs see: http://viaf.org/viaf/sourceID/SRP|person_308 :)
371
+
};
372
+
373
+
(:~
374
+
: Search options passed to ft:query functions
375
+
:)
376
+
declarefunctionsearch:options($proximity){
377
+
let $phrase-slop := if($proximity castableas xs:integer) thenxs:integer($proximity) elsexs:integer(1)
378
+
return
379
+
<options>
380
+
<default-operator>and</default-operator>
381
+
<phrase-slop>{$phrase-slop}</phrase-slop>
382
+
<leading-wildcard>yes</leading-wildcard>
383
+
<filter-rewrite>yes</filter-rewrite>
384
+
</options>
385
+
};
386
+
387
+
(:
388
+
: Build full-text keyword search over full record data
389
+
:)
390
+
declarefunctionsearch:keyword(){
391
+
if(request:get-parameter('q', '') != '') then
392
+
let $string := if(request:get-parameter('keywordProximity', '') castableas xs:integer) then
0 commit comments