|API Support||Since PageSeeder||Last updated||Documentation Date|
|4.9500||5.9300||18 December 2017|
Search the specified index using the Lucene search engine.
Select the index
The current implementation of PageSeeder produces one Lucene index per group. Use the groups parameter to specify which Lucene index to search. The groups parameter can be either a group id or a group name.
Note that while it is possible to search across multiple groups, this class is currently not capable of collating the results from different indexes; specifying multiple group is therefore not recommended.
The main parameters for this servlet are question and fields which will form the main predicate for the search.
The question is typically one or multiple terms, separated with spaces, and may also come directly from the user.
Each term in the question will be converted into Lucene Terms for each field specified in the fields parameters. The fields parameter would typically include the title (
pstitle) and content (
pscontent ) for a full text search. The fields should be indexed by Lucene; and it is preferable that they are analyzed. In order to generate extracts, they must be stored.
The Lucene query produced will be the equivalent of:
+(field1:term1 field1:term2 field2:term1 field2:term2 ...)
The types parameter can be used to choose which types of Lucene documents can be returned as a comma separated list of values; each value should match the value of a 'pstype' field. Valid types include
The Lucene query produced will be the equivalent of:
+(psdocument:type1 psdocument:type2 ...)
This servlet can be used for a faceted search.
Facets cardinality, that is the number of search results matching a facet within the current results is calculated automatically based on the values of the fields specified as facets. Use the facets to specify which fields to use in the index; generally, it is preferable to use fields which are indexed but not analyzed.
As an example, if the facets parameter include the 'psauthor' field, this servlet will calculate for each possible 'psauthor' field value how many results within the current results match each facet value or the 'psauthor' field.
Specifying facets to compute does not affect the search results.
To affect search results, a particular facet must be selected with the select parameter. The select parameter is a comma separated list of Lucene index terms including the field name:
For example, the select parameter value
psauthor:john,pspriority:high will only display results by author 'john' and have priority 'high'.
When selecting facets, the Lucene query produced will be the equivalent of:
+facet1:value1 +facet2:value2 ...)
\. For example
Results can be filtered by date by using either the from and to parameters or the last parameter.
The from and to parameters use dates formatted as ISO-8601 standard (extended format only), for example
2010-10-25T12:26. Open ended date ranges are possible if one of from or to is specified.
The last parameter automatically generates the date range based on the current date using the specified duration; the duration should match:
[span][unit] , where [span] is the length of time (digits only) and [unit] is the quantifier to use, valid units are values are "years", "months", "days", "hours", "minutes" and "seconds".
When filtering by date, the Lucene query produced will be the equivalent of:
[psdate:start TO psdate:end]
When using date filtering, only results which have a date will be returned; in other words, if the Lucene document does not have a date, it will not be considered by the search.
The min-size and max-size parameters can be used to filter documents by byte size, values must be positive integer values. This parameter only applies to URIs (pstype=document) which do have a byte size, such as images, videos, etc.
When filtering by size, the Lucene query produced will be the equivalent of:
[pssize:minsize TO pssize:maxsize]
When using size filtering, only results which have a size will be returned.
The ranges parameter can be used to filter using a set of ranges. It is a comma separated list of range searches with format:
] means include limit value and
} means exclude limit value. For example:
Organizing search results
Results can be paged and ordered.
The page and page-size controls which part of the search results will be returned. They must be positive integer values and will default to
The sortby parameter is a comma separated list of fields to sort the results; the results are sorted by relevance if no sortby parameter is specified.
HTTP method: GET
Same as POST method.
HTTP method: POST
Performs a search based on the specified parameters and returns the search results as XML.
|groups||A list of groups to search (comma-separated list of IDs or names)||yes||strings|
|question||The query entered by the user (not a Lucene query)||no||string|
|fields||A comma separated list of fields to search for the question||no||strings|
|types||A comma separated list of the types of documents to search,||no||enums|
|facets||A comma separated list of fields to include as facets||no||strings|
|facet-size||The maximum number of facet values returned per facet||no||string|
|ranges||A comma separated list of range searches (format is ||no||strings|
|select||A comma separated list of terms to select facets||no||strings|
|sortby||A comma separated list of fields to sort the results, results are sorted by relevance if unspecified||no||strings|
|from||An ISO-8601 date to specify the start of a date range filter,||no||date|
|to||An ISO-8601 date to specify the end of a date range filter,||no||date|
|last||A duration to filter the result||no||enum|
|min-size||The minimum size the document must have||no||int|
|max-size||The maximum size the document must have||no||int|
|page||The current page to view||no||int|
|page-size||How many results does a page contain||no||int|
Supported types are
The format of the parameter must be as follows
[span] is the length of time (digits) and
[unit] is the quantifier to use, valid quantifiers are