Skip to content

Commit

Permalink
bugfixes: too many results *or* failure to find titles with stopwords
Browse files Browse the repository at this point in the history
  • Loading branch information
EfraimFeinstein committed Jun 14, 2016
1 parent 7420f2c commit fe2248e
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions opensiddur-server/src/api/data/outlines.xqm
Expand Up @@ -84,7 +84,12 @@ declare function outl:get-outline-path(
declare function outl:title-search(
$title as xs:string
) as xs:string* {
for $doc in collection($orig:path-base)//tei:titleStmt/tei:title[ft:query(., $title)]/root(.) | ()
let $stopwords := ( "a", "an", "and", "are", "as", "at",
"be", "but", "by", "for", "if", "in", "into", "is", "it", "no", "not", "of",
"on", "or", "such", "that", "the", "their", "then", "there", "these",
"they", "this", "to", "was", "will", "with")
let $title-no-stopwords := string-join(for $t in tokenize($title, '\s+')[not(.=$stopwords)] return "+" || $t, " ")
for $doc in collection($orig:path-base)//tei:titleStmt/tei:title[ft:query(., $title-no-stopwords)]/root(.) | ()
return replace(data:db-path-to-api(document-uri($doc)), "^(/exist/restxq)?/api", "")
};

Expand Down Expand Up @@ -662,7 +667,7 @@ declare
$body,
outl:validate#2,
outl:validate-report#2,
outl:title-function#1,
outl:title-function#1,
false()
)
};
Expand Down

0 comments on commit fe2248e

Please sign in to comment.