A RESTful browser for eXist Function Modules


http://exist-db.org/xquery/lucene
A module for full text indexed searching based on Lucene.

ft:close() empty()
Close the current Lucene document and flush it to disk. Subsequent calls to ft:index will write to a new Lucene document.

ft:get-field($path as xs:string*, $field as xs:string) xs:string*
Retrieve the stored content of a field.
$pathURI paths of documents or collections in database. Collection URIs should end on a '/'.
$fieldquery string

Returns All documents that are match by the query

ft:index($documentPath as xs:string, $solrExression as node()) empty()
Index an arbitrary chunk of (non-XML) data with lucene. Syntax is inspired by Solar.
$documentPathURI path of document in database.
$solrExressionXML syntax expected by Solr' add expression. Element should be called 'doc', e.g.<doc> <field name="field1">data1</field> <field name="field2" boost="value">data2</field> </doc>

ft:index($documentPath as xs:string, $solrExression as node(), $close as xs:boolean) empty()
Index an arbitrary chunk of (non-XML) data with lucene. Syntax is inspired by Solar.
$documentPathURI path of document in database.
$solrExressionXML syntax expected by Solr' add expression. Element should be called 'doc', e.g.<doc> <field name="field1">data1</field> <field name="field2" boost="value">data2</field> </doc>
$closeIf true, close the Lucene document. Subsequent calls to ft:index will thus add to a new Lucene document. If false, the document remains open and is not flushed to disk. Call the ft:close function to explicitely close and flush the current document.

ft:optimize() empty()
Calls Lucene's optimize method to merge all index segments into a single one. This function should be called after adding a larger bunch of documents or if no further changes are expected for a while. The optimize will block the index for other write operations and may take some time. You need to be a user in group dba to call this function.

ft:query($nodes as node()*, $query as item()) node()*
Queries a node set using a Lucene full text index; a lucene index must already be defined on the nodes, because if no index is available on a node, nothing will be found. Indexes on descendant nodes are not used. The context of the Lucene query is determined by the given input node set. The query is specified either as a query string based on Lucene's default query syntax or as an XML fragment. See http://exist-db.org/lucene.html#N1029E for complete documentation.
$nodesThe node set to search using a Lucene full text index which is defined on those nodes
$queryThe query to search for, provided either as a string or text in Lucene's default query syntax or as an XML fragment to bypass Lucene's default query parser

Returns all nodes from the input node set matching the query. match highlighting information will be available for all returned nodes. Lucene's match score can be retrieved via the ft:score function.

ft:query($nodes as node()*, $query as item(), $options as node()?) node()*
Queries a node set using a Lucene full text index; a lucene index must already be defined on the nodes, because if no index is available on a node, nothing will be found. Indexes on descendant nodes are not used. The context of the Lucene query is determined by the given input node set. The query is specified either as a query string based on Lucene's default query syntax or as an XML fragment. See http://exist-db.org/lucene.html#N1029E for complete documentation.
$nodesThe node set to search using a Lucene full text index which is defined on those nodes
$queryThe query to search for, provided either as a string or text in Lucene's default query syntax or as an XML fragment to bypass Lucene's default query parser
$optionsAn XML fragment containing options to be passed to Lucene's query parser. The following options are supported (a description can be found in the docs): <options> <default-operator>and|or</default-operator> <phrase-slop>number</phrase-slop> <leading-wildcard>yes|no</leading-wildcard> <filter-rewrite>yes|no</filter-rewrite> </options>

Returns all nodes from the input node set matching the query. match highlighting information will be available for all returned nodes. Lucene's match score can be retrieved via the ft:score function.

ft:query-field($field as xs:string*, $query as item()) node()*
Queries a Lucene field, which has to be explicitely created in the index configuration.
$fieldThe lucene field name.
$queryThe query to search for, provided either as a string or text in Lucene's default query syntax or as an XML fragment to bypass Lucene's default query parser

Returns all nodes from the input node set matching the query. match highlighting information will be available for all returned nodes. Lucene's match score can be retrieved via the ft:score function.

ft:query-field($field as xs:string*, $query as item(), $options as node()?) node()*
Queries a Lucene field, which has to be explicitely created in the index configuration.
$fieldThe lucene field name.
$queryThe query to search for, provided either as a string or text in Lucene's default query syntax or as an XML fragment to bypass Lucene's default query parser
$optionsAn XML fragment containing options to be passed to Lucene's query parser. The following options are supported (a description can be found in the docs): <options> <default-operator>and|or</default-operator> <phrase-slop>number</phrase-slop> <leading-wildcard>yes|no</leading-wildcard> <filter-rewrite>yes|no</filter-rewrite> </options>

Returns all nodes from the input node set matching the query. match highlighting information will be available for all returned nodes. Lucene's match score can be retrieved via the ft:score function.

ft:remove-index($documentPath as xs:string) empty()
Remove any (non-XML) Lucene index associated with the document identified by the path parameter. This function will only remove indexes which were manually created by the user via the ft:index function. Indexes defined in collection.xconf will NOT be removed. They are maintained automatically by the database. Please note that non-XML indexes will also be removed automatically if the associated document is deleted.
$documentPathURI path of document in database.

ft:score($node as node()) xs:float*
Returns a computed relevance score for the given node. The score is the sum of all relevance scores provided by Lucene for the node and its descendants. In general, the score will be a number between 0.0 and 1.0 if the query had $node as context. If the query targeted multiple descendants of $node (e.g. 'title' and 'author' within a 'book'), the score will be the sum of all sub-scores and may thus be greater than 1.
$nodethe context node

Returns sum of all relevance scores provided by Lucene for all matches below the given context node

ft:search($path as xs:string*, $query as xs:string) node()
Search for (non-XML) data with lucene
$pathURI paths of documents or collections in database. Collection URIs should end on a '/'.
$queryquery string

Returns All documents that are match by the query

ft:search($query as xs:string) node()
Search for (non-XML) data with lucene
$queryquery string

Returns All documents that are match by the query
Return to list of all modules