http://onionworks.net/2004/search

query (rangeFrom : int, rangeTo : int, field : string, [keywordFields : string], [whitespaceFields : string], query : string, [fuzzySearchValue : string]) : nodeset

The method “query” executes a query to Lucene, and returns the found values.

The first two parameters indicate which value range is to be returned. If, for example, one is indicated for “rangeFrom” and 100 for “rangeTo”, the first top 100 values are returned.

For “field”, the field names can be set which were defined for indexing the data.

So that filtering by keywords is possible in the querystring, these keywords must be communicated to the parameter “keywordFields”. If this is not done, it will be attempted to divide up the search parameter during processing and look for them. This may lead to a false result or no result. If several keywords are specified, these are transferred to the parameter with a blank in between them.

For “whitespaceFields”, as for keywordFields, the fields to be executed with the WhitespaceAnalyzer are specified.

Finally, the querystring must now be specified. The syntax corresponds to that of Lucene and can also be consulted in the appropriate documentation.

<xsl:for-each select="search:query(1, 100, 'fulltext', 'documentType language', 'documentType:Office AND language:en AND Berlin')/result/object">
<xsl:value-of select="@id" />
<br />
</xsl:for-each>
Outputting the IDs of all found values

In the example above there is a full text, as well as two field types “document type” and “language”. Filtering is to be carried out here by the documentType 'Office' and the language 'en'. The results are also filtered by a word to be contained in the full text. The two field types were declared as a keyword and were therefore specified in the keyword list.