lux.functions
Class Search

java.lang.Object
  extended by net.sf.saxon.lib.ExtensionFunctionDefinition
      extended by lux.functions.SearchBase
          extended by lux.functions.Search
All Implemented Interfaces:
Serializable

public class Search
extends SearchBase

function lux:search($query as item(), $hints as xs:integer, $sort as xs:string?, $start as xs:int?) as document-node()*

Executes a Lucene search query and returns documents. If the query argument is an element or document node, it is parsed using the XmlQueryParser; otherwise its string value is parsed using the LuxQueryParser. For details about the query syntaxes, see the parser documentation.

The optimizer provides optimization information in the $hints variable

$sort defines sort criteria: multiple criteria are separated by commas; each criterion is a field name (or lux:score) with optional keywords appended: ascending|descending, empty least|empty greatest. If no sort key is provided, documents are ordered by Lucene docID, which is defined to be XQuery document order.

$start indiciates the (1-based) index of the first result to return. Skipped results don't need to be loaded in memory, so providing $start allows for more efficient processing of queries that require "deep paging".

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class lux.functions.SearchBase
SearchBase.SearchCall
 
Constructor Summary
Search()
           
 
Method Summary
 net.sf.saxon.value.SequenceType[] getArgumentTypes()
           
 net.sf.saxon.om.StructuredQName getFunctionQName()
           
 int getMaximumNumberOfArguments()
           
 net.sf.saxon.value.SequenceType getResultType(net.sf.saxon.value.SequenceType[] suppliedArgumentTypes)
           
 net.sf.saxon.om.SequenceIterator<net.sf.saxon.om.NodeInfo> iterate(org.apache.lucene.search.Query query, Evaluator eval, long facts, String sortCriteria, int start)
          Iterate over the search results
 
Methods inherited from class lux.functions.SearchBase
getEvaluator, getMinimumNumberOfArguments, makeCallExpression
 
Methods inherited from class net.sf.saxon.lib.ExtensionFunctionDefinition
dependsOnFocus, hasSideEffects, trustResultType
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Search

public Search()
Method Detail

getFunctionQName

public net.sf.saxon.om.StructuredQName getFunctionQName()
Specified by:
getFunctionQName in class net.sf.saxon.lib.ExtensionFunctionDefinition

getResultType

public net.sf.saxon.value.SequenceType getResultType(net.sf.saxon.value.SequenceType[] suppliedArgumentTypes)
Specified by:
getResultType in class net.sf.saxon.lib.ExtensionFunctionDefinition

getArgumentTypes

public net.sf.saxon.value.SequenceType[] getArgumentTypes()
Overrides:
getArgumentTypes in class SearchBase

getMaximumNumberOfArguments

public int getMaximumNumberOfArguments()
Overrides:
getMaximumNumberOfArguments in class SearchBase

iterate

public net.sf.saxon.om.SequenceIterator<net.sf.saxon.om.NodeInfo> iterate(org.apache.lucene.search.Query query,
                                                                          Evaluator eval,
                                                                          long facts,
                                                                          String sortCriteria,
                                                                          int start)
                                                                   throws net.sf.saxon.trans.XPathException
Iterate over the search results

Specified by:
iterate in class SearchBase
Parameters:
query - the query to execute
eval -
Returns:
an iterator with the results of executing the query and applying the expression to its result.
Throws:
net.sf.saxon.trans.XPathException


Copyright © 2013. All Rights Reserved.