Commit bd76b8e3 authored by Mathias Goebel's avatar Mathias Goebel 🎠
Browse files

add reindex on the very first ingest

parent 596f2c5b
......@@ -72,10 +72,17 @@ declare function tgconnect:publish( $uri as xs:string,
else true()
return
if ( $log )
(: we are logged in, so we can proceed :)
(: test for valid login :)
if (not($log))
then
error(
QName("https://sade.textgrid.de/ns/error", "PUBLISH02"),
"error authenticating for " || $user || " on " || $targetPath
)
(: we are logged in, so we can proceed :)
else
let $prepare as xs:boolean := local:prepare()
let $isNewCollection as xs:boolean := collection($targetPath || "/data") => count() gt 1
let $tgcrudUrl as xs:string := config:get("textgrid.tgcrud") => string()
let $preserveRevisions := config:get("textgrid.preserveRevisions") = "true"
......@@ -149,7 +156,12 @@ declare function tgconnect:publish( $uri as xs:string,
if( ($grammar = "" ) or not($instance//tei:TEI) or not( doc-available( $relaxNGPath ) )) then () else
validation:validate-report($instance, doc($relaxNGPath))
(: $grammar:)
let $reindexOnNewInstallation :=
(: on a new installation of the SADE server, the
collection index is not ready as the reindex fetches no
document to parse. so we need a reindex when no data WAS
present before we got THIS document. :)
if($isNewCollection) then xmldb:reindex($targetPath || "/data") else true()
return ($targetUri, $validate)
case "text/xml+xslt" return
......@@ -221,11 +233,7 @@ declare function tgconnect:publish( $uri as xs:string,
"The publisher does not know how to handle " || string($meta//tgmd:format) || "."
)
else
error(
QName("https://sade.textgrid.de/ns/error", "PUBLISH02"),
"error authenticating for " || $user || " on " || $targetPath
)
};
(:~
......
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