Database Reference
In-Depth Information
Searching with the Full-Text Index
Using the full-text index to search for words and phrases is done through the exten‐
sion functions in the lucene extension module (see ft ). The default namespace prefix
for this module is ft .
Basic Search Operations
The basic function for using full-text indexes is ft:query . We've already seen some
examples of its use in “Full-Text Index and KWIC Example” on page 285 . Its full def‐
inition is:
ft:query ( $ nodes , $ query , [ $ options ])
where:
$node Contains the node set to search.
$quer Contains the search query. If this is a string, it is assumed to be in Lucene's native
query syntax (described in the next section). For more complex queries, you may
provide an XML fragment as described in “The full-text query XML specifica‐
tion” on page 293 .
$options
An optional parameter that contains additional query options. See “Additional
search parameters” on page 295 .
Lucene's native query syntax
Lucene has a native query syntax for defining full-text searches. Its full definition can
be found at http://lucene.apache.org/core/3_6_1/queryparsersyntax.html . Here are
some examples:
exist database searches for text with the terms exist and/or database . This is
equivalent to writing exist OR database .
• You can use wildcards like data* for multiple unknown characters, or database?
for a single unknown character.
• If you want to search on a phrase (multiple words), use quotes: "exist data
base" .
• You can also do a proximity searche. "exist database"~10 means that the
words “eXist” and “database” must occur within 10 words of each other.
Search WWH ::




Custom Search