Skip to content

Instantly share code, notes, and snippets.

@joewiz
Forked from dariok/test7-result.xml
Last active August 22, 2016 17:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joewiz/a652fe44045d2808d2ef26c1528b4079 to your computer and use it in GitHub Desktop.
Save joewiz/a652fe44045d2808d2ef26c1528b4079 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 :=
<listPerson xmlns="http://www.tei-c.org/ns/1.0">
<person>
<persName xml:id="person">
<forename/>
<surname/>
</persName>
</person>
</listPerson>
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:listPerson/tei:person/tei:persName
let $on-disk-indexed-node := doc('/db/test/test.xml')/tei:listPerson/tei:person/tei:persName
for $node in ($in-memory-node/tei:person/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