Creates a SearchClient instance using the supplied settings object. Please see getting-started section for an introduction on how to set up the instance.
A settings object that indicates how the search-client instance is to behave.
Holds a reference to the setup Authentication service.
Holds a reference to the setup Autocomplete service.
Holds a reference to the setup Categorize service.
Holds a reference to the setup Find service.
Holds a reference to method resolving jwt access token.
Holds a reference to the currently set authentication token.
Gets the currently active categorizationType value.
Sets the currently active categorizationType.
Will run trigger-checks and potentially update services.
Gets the currently active client-id value.
Sets the currently active client-id.
Will run trigger-checks and potentially update services.
Gets the currently active date-from value.
Sets the from-date for matches to be used.
Will run trigger-checks and potentially update services.
Gets the currently active date-to value.
Sets the to-date for matches to be used.
Will run trigger-checks and potentially update services.
Gets the currently active match generateContent setting.
Sets whether the results should generate the content or not.
Note: Requires the backend IndexManager to have the option enabled in its configuration too.
Will run trigger-checks and potentially update services.
Gets the currently active match generateContentHighlights setting.
Sets whether the results should generate the content-highlight tags or not.
Note: See the matchGenerateContent property in regards to IndexManager requirements.
Will run trigger-checks and potentially update services.
Gets the currently active match grouping mode.
Sets whether the results should be grouped or not.
Note: Requires the search-service to have the option enabled in it's configuration too.
Will run trigger-checks and potentially update services.
Gets the currently active match-page.
Sets the match-page to get. Will run trigger-checks and potentially update services.
Gets the currently active match page-size.
Sets the match page-size to be used. Will run trigger-checks and potentially update services.
Gets the currently active max number of autocomplete suggestions to get.
Sets the max number of autocomplete suggestions to get. Will run trigger-checks and potentially update services.
Returns the currently active query.
Sets the query to use. Consider using the queryText-property for query-text-changes instead.
Note: Changing the query
property will likely lead to multiple trigger-checks and potential updates.
This is because changing the whole value will lead to each of the query-objects' properties to trigger individual
events.
To avoid multiple updates, call deferUpdates(true)
before and deferUpdates(false) afterwards. Then at max
only one update will be generated.
Gets the currently active query-object.
Sets the query-text to be used. Will run trigger-checks and potentially update services.
Gets the currently active search-type value.
Sets the search-type to be used. Will run trigger-checks and potentially update services.
Gets the currently active match generateContent setting.
Sets the language that the client uses. Affects category-names (and in the future maybe metadata too). The expected values should be according to the https://www.wikiwand.com/en/IETF_language_tag standard.
Changes will run trigger-checks and potentially update services.
Decides whether an update should be executed or not. Typically used to temporarily turn off update-execution. When turned back on the second param can be used to indicate whether pending updates should be executed or not.
Note: Changes deferring of updates for all components (Autocomplete, Categorize and Find). Use the service properties of the SearchClient instance to control deferring for each service.
Turns on or off deferring of updates.
Used to indicate if a pending update is to be executed or skipped when deferring
is turned off. The param is ignored for state=true
. Default is false.
Toggle the given filter.
Will run trigger-checks and potentially update services.
Is either string[], Filter or Category. When string array it expects the equivalent of the Category.categoryName property, which is like this: ["Author", "Normann"].
true if the filter was added, false if it was removed.
This method is called when you want to force an update call to be made for the services.
It may force an update based on the existing this.query value or you can provide a new query object to be used. After having set the value the services will be called, unless they are disabled in their respective configs or turned off in the params to this method.
If passed in then the query object will update the internal query-object without triggering any updates, but will just after this force an update on all enabled services, that are not turned off by the consecutive params.
Allows turning off updates for the Autocomplete service (if the service is enabled in the settings).
Allows turning off updates for the Categorize service (if the service is enabled in the settings).
Allows turning off updates for the Find service (if the service is enabled in the settings).
Checks whether any child-node of the given category has a filter defined for it. Typically used to visually show in the tree that a child-node has an active filter.
Gets the next page of match-results (if any). Will run trigger-checks and potentially update services.
Gets the previous page of match-results. Will run trigger-checks and potentially update services.
Resets the SearchClient instance (filters, queryText, categoryPresentations++) to initial values.
This method is typically called when the user clicks the search-button in the UI.
For query-fields that accepts enter the default queryChangeInstantRegex catches enter. When they don't take enter you will have to set up something that either catches the default enter or a user clicks on a "Search"-button or similar. You can choose to use the already current query, or you can pass it in. If you include the query then the internal updates are suppressed while changing the query-properties, to make sure that only one update per service is made (if any of their trigger-checks returned true).
If passed in then the query object will update the internal query-object and any updates will trigger (but only once). The consecutive overriding service params are ignored when this parameter has a value. If the query is empty/null/undefined then the services will force an update, but allows the bool params to override this.
Allows turning off updates for the Autocomplete service (if the service is enabled in the settings). Only effective when query is not set.
Allows turning off updates for the Categorize service (if the service is enabled in the settings). Only effective when query is not set.
Allows turning off updates for the Find service (if the service is enabled in the settings). Only effective when query is not set.
Generated using TypeDoc
This is the "main class" of this package. Please read the getting-started section" for a proper introduction.
The SearchClient manages a range of other services:
Each of the above services can be used independently, but it is highly recommended to use the SearchClient instead.
The SearchClient allows you to have an advanced search with minimal effort in regards to setup and logics. instead of having to write all the logics yourself the SearchClient exposes the following methods for managing your search:
What happens is that any query-changes that arrive are checked in regards to trigger-settings. If they are to trigger and a callback has been set up then the server is requested and when the data is received it is sent to the callback registered in the settings-object.