Skip to content

Instantly share code, notes, and snippets.

@dariok
Created August 22, 2016 14:04
Show Gist options
  • Save dariok/d5e0b972e59ed807e19db23c7c696fa5 to your computer and use it in GitHub Desktop.
Save dariok/d5e0b972e59ed807e19db23c7c696fa5 to your computer and use it in GitHub Desktop.
xquery version "3.1";
declare namespace tei = "http://www.tei-c.org/ns/1.0";
let $set-up-collections :=
(
xmldb:create-collection('/db', 'test'),
xmldb:create-collection('/db/system/config/db', 'test')
)
let $in-memory-node :=
<person xmlns="http://www.tei-c.org/ns/1.0">
<persName xml:id="person">
<forename/>
<surname/>
</persName>
</person>
let $store-unindexed-doc := xmldb:store('/db', 'test.xml', $in-memory-node)
let $store-indexed-doc := xmldb:store('/db/test', 'test.xml', $in-memory-node)
let $config :=
<collection xmlns="http://exist-db.org/collection-config/1.0">
<index xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:tei="http://www.tei-c.org/ns/1.0">
<!--<fulltext default="none" attributes="false"/>-->
<lucene>
<analyzer class="org.apache.lucene.analysis.standard.StandardAnalyzer"/>
<text qname="tei:div"/>
</lucene>
</index>
</collection>
let $store-config := xmldb:store('/db/system/config/db/test', 'collection.xconf', $config)
let $reindex := xmldb:reindex('/db/test')
let $on-disk-unindexed-node := doc('/db/test.xml')/tei:person/tei:persName
let $on-disk-indexed-node := doc('/db/test/test.xml')/tei:person/tei:persName
for $node in ($in-memory-node/tei:persName, $on-disk-unindexed-node, $on-disk-indexed-node)
return
($node/tei:forename and $node/tei:surname)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment