Skip to content

Commit

Permalink
Merge pull request #13 from HistoryAtState/new-indexes
Browse files Browse the repository at this point in the history
WIP: Apply new indexes
  • Loading branch information
joewiz authored Apr 10, 2023
2 parents 3bbab0d + 7479f7e commit 80c9b63
Show file tree
Hide file tree
Showing 6 changed files with 78 additions and 25 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ build/*
.existdb.json
.DS_Store
expath-pkg.xml
repo.xml
repo.xml
.idea/*
22 changes: 0 additions & 22 deletions collection.xconf

This file was deleted.

16 changes: 14 additions & 2 deletions pre-install.xql
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,18 @@ declare function local:mkcol($collection, $path) {
local:mkcol-recursive($collection, tokenize($path, "/"))
};

(: store the collection configuration :)
(: create the collection configuration collection :)
local:mkcol("/db/system/config", $target),
xdb:store-files-from-pattern(concat("/system/config", $target), $dir, "*.xconf")

(: store the collection configurations :)
for $xconf in file:directory-list($dir, "*.xconf")/file:file/@name
let $data-dir := substring-before($xconf, ".xconf")
return
(
local:mkcol-recursive(concat("/db/system/config/", $target), $data-dir),
xmldb:store-files-from-pattern(
concat("/db/system/config", $target, "/", $data-dir),
$dir,
$xconf
)
)
27 changes: 27 additions & 0 deletions president-travels.xconf
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<collection xmlns="http://exist-db.org/collection-config/1.0">
<index xmlns:tei="http://www.tei-c.org/ns/1.0" xmlns:frus="http://history.state.gov/frus/ns/1.0" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<lucene>
<analyzer class="org.apache.lucene.analysis.standard.StandardAnalyzer">
<!-- Specify stop words - or remove them entirely -->
<param name="stopwords" type="org.apache.lucene.analysis.util.CharArraySet">
<!--<value>the</value>-->
</param>
</analyzer>
<text qname="trips" index="no">
<!-- start required facets and fields -->
<facet dimension="hsg-category" expression="'department'"/>
<facet dimension="hsg-publication" expression="'travels'"/>
<field name="hsg-fulltext" store="no" expression="trip/name, trip/country, trip/remarks, trip/locale"/>
<field name="hsg-url" expression="'/departmenthistory/travels/president/' || util:document-name(.) =&gt; substring-before('.xml')"/>
<!-- end required facets and fields -->
</text>
</lucene>
<range>
<create match="//trip">
<field name="trip-who" match="@who" type="xs:string"/>
</create>
<create qname="country" type="xs:string"/>

</range>
</index>
</collection>
9 changes: 9 additions & 0 deletions presidents.xconf
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<collection xmlns="http://exist-db.org/collection-config/1.0">
<index xmlns:xs="http://www.w3.org/2001/XMLSchema">
<range>
<create match="//president">
<field name="president-id" match="id" type="xs:string"/>
</create>
</range>
</index>
</collection>
26 changes: 26 additions & 0 deletions secretary-travels.xconf
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<collection xmlns="http://exist-db.org/collection-config/1.0">
<index xmlns:tei="http://www.tei-c.org/ns/1.0" xmlns:frus="http://history.state.gov/frus/ns/1.0" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<lucene>
<analyzer class="org.apache.lucene.analysis.standard.StandardAnalyzer">
<!-- Specify stop words - or remove them entirely -->
<param name="stopwords" type="org.apache.lucene.analysis.util.CharArraySet">
<!--<value>the</value>-->
</param>
</analyzer>
<text qname="trips" index="no">
<!-- start required facets and fields -->
<facet dimension="hsg-category" expression="'department'"/>
<facet dimension="hsg-publication" expression="'travels'"/>
<field name="hsg-fulltext" store="no" expression="trip/name, trip/country, trip/remarks, trip/locale"/>
<field name="hsg-url" expression="'/departmenthistory/travels/secretary/' || util:document-name(.) =&gt; substring-before('.xml')"/>
<!-- end required facets and fields -->
</text>
</lucene>
<range>
<create match="//trip">
<field name="trip-who" match="@who" type="xs:string"/>
</create>
<create qname="country" type="xs:string"/>
</range>
</index>
</collection>

0 comments on commit 80c9b63

Please sign in to comment.