Overview
The Hawksearch results widget also has an implementation with VueReactJS. js provides out-of-the box access to the Hawksearch service. The framework specifics expose some particular features that cover many advanced scenariosThis version provides the most common use cases of the search service.
Goal
This document provides information on setting up the Hawksearch results widget using Vue.jsReactJS. Basic usage is covered in Selecting React or Vue and any additional information may be found here.
Prerequisite
Info |
---|
Configured Hawksearch results widget. |
Steps for setup
Open the selected widget template file
Uncomment, if necessary, the part of the markup designated as Vue React template. This should include a
div
element with attributedata-component="react-app"
ordata-component="vuereact-app-spabootstrap"
. In it, there should be Vue components namedsearch-box
,facet-list
andresults
It should be an emptydiv
element. Comment the part marked as React Vue template. Only this step is required for enabling the componentscomponent, the rest of the steps are optional.Modify the
data-client-guid
attribute to set the Hawksearch client ID.Modify the
data-hawksearch-base-api
attribute to set the Base API URL.Modify the
data-hawksearch-search-api
attribute to set the Search API URLModify the
data-json-params
attribute (JSON object, param_name: param_value) to set additional search parameters, specific for the widget instance.Modify the
data-index-name
attribute to set index for the widget search requests.Edit the HTML structure around<search-box>
,<facet-list>
and<results>
to set the desired layout. The existing classes are used for the built-in theme. There is an additional Razor condition if thesearch box should be shownModify the
data-show-searchbox
attribute to toggle the visibility of the search field.Save, re-build and refresh the page.