Files
docker-gdp/Docker/basex/gdp-entrypoint.sh
T
2022-01-20 16:36:57 +01:00

42 lines
2.2 KiB
Bash
Executable File

#!/bin/sh
# todo: run some checks
id
ls -ls / | grep srv
echo "Creating GDP BaseX db"
basex "db:create('gdp','/srv/basex/src/gdp.tei.xml', (),map {'ftindex': true(),'stemming': true(),'casesens': true(),'diacritics': true(),'language': 'fr','updindex': true(),'autooptimize': true(),'maxlen': 96,'maxcats': 100,'splitsize': 0,'chop': false(),'textindex': true(),'attrindex': true(),'tokenindex': true(), 'xinclude': true()})"
# , 'serializer': 'indent=no'
echo "Creating FullText Index tmp file"
basex "xslt:transform(fn:doc('/srv/basex/src/gdp.tei.xml'), fn:doc('/srv/basex/src/xslt/generateFullTextIndex.xsl'))" > /tmp/gdpFtIndex.xml
echo "Creating FullText Index DB"
basex "db:create('gdpFtIndex', '/tmp/gdpFtIndex.xml', (),map {'ftindex': true(),'stemming': true(),'casesens': true(),'diacritics': true(),'language': 'fr','updindex': true(),'autooptimize': true(),'maxlen': 96,'maxcats': 100,'splitsize': 0,'chop': false(),'textindex': true(),'attrindex': true(),'tokenindex': true(), 'xinclude': true()})"
# , 'serializer': 'indent=no'
# echo "Creating Advanced Search Index"
# basex -q "import module namespace gdp.models.tei = 'gdp.models.tei' at '/srv/basex/webapp/synopsx/workspace/gdp/models/tei.xqm' ;
# let $index := ('gdpIndexNominum', 'gdpIndexLocorum')
# return gdp.models.tei:addId2IndexedEntities($index)"
# basex "declare namespace tei = 'http://www.tei-c.org/ns/1.0' ;
# let $db := db:open('gdp')
# let $index := $db//tei:TEI[tei:teiHeader//tei:sourceDesc[@xml:id = $indexId]]
# for $occurence in fn:distinct-values($index//tei:listRelation/tei:relation/@passive ! fn:tokenize(., '\s+'))
# let $entries := $index//*[tei:listRelation/tei:relation[fn:contains(@passive, $occurence)]]
# let $element := $db//*[@xml:id = fn:substring-after($occurence, '#')]
# let $values := for $entry in $entries/@xml:id return fn:concat('#', $entry)
# return
# if ($element[fn:not(@ref)])
# then insert node attribute ref { $values } into $element
# else replace value of node $element/@ref with $values"
# as we override the parent container CMD, we have to launch basexhttp here
echo "Launching basexhttp"
basexhttp
# todo never launched, prev command never ends
echo "Launching indexing"
wget -S http://localhost:8984/indexing