RunConsilioSearch (open)
Search an index
Syntax
LOADLIB "mod::consilio/lib/api.whlib";
RECORD FUNCTION RunConsilioSearch(STRING indextag, RECORD query, RECORD options)
Parameters
STRING indextag
Index to search (module:tag)
RECORD query
Search query
RECORD options
Options
RECORD aggregation_mapping
For aggregation queries, only the aggregation results will be returned, mapped
using the mapping
option, not the actual matching documents. By supplying a separate aggregation mapping, the
aggregation results are returned separately in an "aggregation"
result field
INTEGER count
The number of results to return (-1 for all results, defaults to 100)
STRING ARRAY exclude_urls
For site searches: Results with a URL starting with one of these exclude_urls are not returned
INTEGER first
The first result to return (0-based, defaults to 0)
STRING highlightclass
The CSS class used to highlight found query words in the highlightfields
(set to
empty string to disable match highlighting)
STRING ARRAY highlightfields
The fields in which found query words should be highlighted (note that all fields mentioned in highlightfields are HTML-encoded)
STRING ARRAY highlightparts
The fields from which only a relevant highlighted part (with max length
"summary_length"
) will be returned in the summaryfield, defaults to [ "body" ]
(note that all fields mentioned in
highlightparts are HTML-encoded)
STRING highlighttype
Which highlighting algorithm to use, either unified
(the default) or plain
(see
https://opensearch.org/docs/latest/search-plugins/searching-data/highlight/#highlighter-types for more information)
STRING language
The language to use (legacy Consilio indices only, defaults to the language returned by GetTidLanguage)
RECORD mapping
The fields in this record will be returned in the search results and updated with the
values returned by Consilio (defaults to DEFAULT RECORD
, which returns all known fields)
STRING orderby
Field to order over (defaults to ""
, which orders descending by score, can be set to the
value of the scorefield
option, doesn't have to be a field in the mapping
option)
BOOLEAN orderdesc
Whether to reverse the ordering (defaults to TRUE
when ordering by score or FALSE
when ordering by another field)
RECORD ARRAY ordering
Advanced results ordering, overrides the orderby
and orderdesc
options
STRING ordering.orderby
Field to order over (required, can be set to the value of the scorefield
option,
doesn't have to be a field in the mapping
option, but it should be an indexed field)
BOOLEAN ordering.orderdesc
Whether to reverse the ordering (defaults to TRUE
when ordering by score or
FALSE
when ordering by another field)
STRING ordering.ordermode
Sort mode to use (one of "min"
, "max"
, "sum"
, "avg"
or "median"
,
defaults to "min"
when sorting ascending or "max"
when sorting descending)
BOOLEAN refresh
Refresh the catalog before searching, making sure very recent changes are picked up
STRING restrict_url
For site searches: Only results with a URL starting with this restrict_url are returned
BOOLEAN save_searches
If the search query should be saved for search reports (defaults to FALSE
)
INTEGER save_searches_site
Set an explicit site id to save the query for (by default, Consilio tries to
determine the site id by checking if the index contains only one publisher content source or by using
LookupPublisherUrl on the restrict_url
)
STRING scorefield
The name of the field to return the result score in (set to empty string to not return
scores, defaults to ""
)
STRING summaryfield
The name of the field to return the summary in (set to empty string to not return the
summary, defaults to "summary"
)
INTEGER summary_length
The length of the summary to generate for each result (-1 for the default length of 200, 0 to prevent summary generation, defaults to -1)
INTEGER totaltotrack
By default, only up to a certain results are counted with the totalexact
return
value being set to FALSE if there are more than that number of results. Set this option to the number of results that
should be always be counted or to -1 to always return the exact number of results (a higher setting comes with a
performance cost). Defaults to 10,000.
BOOLEAN validatemapping
Validate the specified mapping. Defaults to TRUE
Return value
RECORD
The search result
RECORD ARRAY aggregation
The aggregation results for an aggregation query with a separate aggregation
mapping (see the aggregation_mapping
option)
STRING ARRAY eventmasks
Event masks to listen to for changes to this query
RECORD ARRAY results
The actual results
INTEGER totalcount
The total number of results (not necessarily the number of returned results, if count
is set to a value >= 0)
BOOLEAN totalexact
If the total number of results is exact, if FALSE it's a lower bound for the actual number of results