Suggest search

About

Returns a component that handles suggest searches towards Open Content and builds up a query that will return a set of requested items

Can also be configured to handle date searches:

Handles created date sorting by default but through config can add multiple sorting fields

How to use

Property

Description

Default

dateSearch

A boolean whether dateSearch should be displayed

false

cacheLastSearch

A boolean whether last search will be cached

false

cacheKey

A string to identify the specific cache payload

onSearch

Callback function when a search has occurred

ocInstance

A instance of Content Agent open content object

autoSearch

Trigger a search when component did mount

false

suggestSearchConfig

Search config (see below)

searching

A callback function when searching is triggered, returns searching state (true/false)

localizations

A object for translating strings

Key

Value

suggestFields

Array of objects containing information what to trigger suggestions on

{ name: 'indexfield to to suggest against', order: integer to determine order of output in list }

suggestLabels

Object containing labels for the suggestions fields

searchOptions

{ start: search start index, limit: number of hits to get back, property: properties to fetch with the search, filters: array of objects containing sub filters for query, defaultQuery: the default query to search for, filterQuery: a filter that will always be added, sortField: a property that the query will be sorted on, sortAscending: a boolean to determine sorting order }

dateOptions

{ properties: [ sortable: boolean if the property is sortable label: label to output value: OC date property ] }

Last updated

Was this helpful?