Database Reference
In-Depth Information
<html>
<head>
<meta HTTP-EQUIV = " Content-Type " content = " text/html; charset=UTF-8 " />
<title> { $ page-title } </title>
</head>
<body>
<h1> { $ page-title } </h1>
<p> Search phrase: " { $ searchphrase } " </p>
<ul>
{
for $ line in collection ( "/db/apps/exist101/data" )// SPEECH / LINE
[ ft:query (., $ searchphrase )]
return
<li>
from: { string ( root ( $ line )/ PLAY / TITLE )} <br/>
<i> { string ( $ line )} </i>
</li>
}
</ul>
</body>
</html>
Its main difference from search-1.xq is the way the search expression is formulated:
collection ( '/db/apps/exist101/data' )// SPEECH / LINE [ ft:query (., $ searchphrase )]
The ft:query function looks for an index on the elements in its first argument. How‐
ever, since this index is not yet there, the result set will currently still be empty (which
we can easily prove by searching on fantasy using the indexed search). So, let's define
this index.
Index definitions (and some other content) are kept in what is best described as a
“shadow” database collection structure underneath /db/system/config . If you go there
(using, for instance, the collection browser of the dashboard), you'll see parts of the
main database collection structure there too, starting with /db .
To add our play index definition, create the collection /db/system/config/db/apps/
exist101/data . In this collection create an XML document called collection.xconf with
the contents shown in Example 3-10 .
Example 3-10. The index definition collection.xconf document
<collection xmlns = " http://exist-db.org/collection-config/1.0 " >
<index xmlns:tei = " http://www.tei-c.org/ns/1.0 " >
<lucene>
<text qname = " LINE " />
</lucene>
</index>
</collection>
Search WWH ::




Custom Search