RunConsilioSearch (open)
Search an index
Syntax
LOADLIB "mod::consilio/lib/api.whlib";
RECORD FUNCTION RunConsilioSearch(STRING indextag, RECORD query, RECORD options)Parameters
STRING indextagIndex to search (module:tag)
RECORD querySearch query
RECORD optionsOptions
RECORD aggregation_mappingFor 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 countThe number of results to return (-1 for all results, defaults to 100)
STRING ARRAY exclude_urlsFor site searches: Results with a URL starting with one of these exclude_urls are not returned
INTEGER firstThe first result to return (0-based, defaults to 0)
STRING highlightclassThe CSS class used to highlight found query words in the highlightfields (set to
empty string to disable match highlighting)
STRING ARRAY highlightfieldsThe fields in which found query words should be highlighted (note that all fields mentioned in highlightfields are HTML-encoded)
STRING ARRAY highlightpartsThe 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 highlighttypeWhich 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 languageThe language to use (legacy Consilio indices only, defaults to the language returned by GetTidLanguage)
RECORD mappingThe 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 orderbyField 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 orderdescWhether to reverse the ordering (defaults to TRUE when ordering by score or FALSE
when ordering by another field)
RECORD ARRAY orderingAdvanced results ordering, overrides the orderby and orderdesc options
STRING ordering.orderbyField 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.orderdescWhether to reverse the ordering (defaults to TRUE when ordering by score or
FALSE when ordering by another field)
STRING ordering.ordermodeSort mode to use (one of "min", "max", "sum", "avg" or "median",
defaults to "min" when sorting ascending or "max" when sorting descending)
BOOLEAN refreshRefresh the catalog before searching, making sure very recent changes are picked up
STRING restrict_urlFor site searches: Only results with a URL starting with this restrict_url are returned
BOOLEAN save_searchesIf the search query should be saved for search reports (defaults to FALSE)
INTEGER save_searches_siteSet 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 scorefieldThe name of the field to return the result score in (set to empty string to not return
scores, defaults to "")
STRING summaryfieldThe name of the field to return the summary in (set to empty string to not return the
summary, defaults to "summary")
INTEGER summary_lengthThe 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 totaltotrackBy 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 validatemappingValidate the specified mapping. Defaults to TRUE
Return value
RECORDThe search result
RECORD ARRAY aggregationThe aggregation results for an aggregation query with a separate aggregation
mapping (see the aggregation_mapping option)
STRING ARRAY eventmasksEvent masks to listen to for changes to this query
RECORD ARRAY resultsThe actual results
INTEGER totalcountThe total number of results (not necessarily the number of returned results, if count
is set to a value >= 0)
BOOLEAN totalexactIf the total number of results is exact, if FALSE it's a lower bound for the actual number of results