Note |
---|
This information is for older versions of Hawksearch and not the latest v4.0. This is not compatible with the Search Api or Indexing Api. Please contact Hawksearch for more information |
Table of Contents
Table of Contents |
---|
...
Hawksearch has three environments available: Development, Staging/Test and a load-balanced Production. When performing integration, each engine can be accessed by using these domains:
Development Environment
When including the scripts below, please use the appropriate domains for the development environment.
Hawk URL: http://dev.hawksearch.net/
Tracking URL: http://tracking-dev.hawksearch.net/
Recommendations URL: http://recs-dev.hawksearch.net/Staging/Test Environment
When including the scripts below, please use the appropriate domains for the test environment.
Engine Reference URL: http://test.hawksearch.net/
Tracking URL: http://tracking-test.hawksearch.net/
Recommendations URL: http://recs-test.hawksearch.net/Production Environment
When including the scripts below, please use the following domain for the production/live environment.
Engine Reference URL: http://yourenginename.hawksearch.com/ Provided at time of launch.
Tracking URL: http://tracking-na.hawksearch.com/
Recommendations URL: http://recs-na.hawksearch.com/
...
Sample Hawksearch Engine
As reference, a sample Hawksearch engine exists to test out API usage. This engine exists at:
...
API Response Examples below display what properties are returned for each element.
Pagination Object
Expand | |||||
---|---|---|---|---|---|
| |||||
|
Sorting Object
Expand | ||
---|---|---|
| ||
|
Results Object
Expand | |||||
---|---|---|---|---|---|
| |||||
|
Facets Object
Expand | |||||
---|---|---|---|---|---|
| |||||
|
Selections Object
Code Block |
---|
"Selections": { "department": { "Label": "Department", "Items": [ { "Label": "Kids", "Value": "Kids" } ] } } |
...
To enable it on your page, there are two steps:
Add the Auto-Complete JavaScript block to the end of the <BODY> tag.
textboxname is the ID of the search text box. Look to your existing HTML code to add the matching ID.
textboxnamefooter is the ID of the search text box if you have one on the footer. Look to your existing HTML code to add the matching ID.
Code Block | ||
---|---|---|
| ||
<!-- Hawksearch - Auto-Suggest --> <script type="text/javascript"> //<![CDATA[ HawkSearch.initAutoSuggest = function () { HawkSearch.suggestInit('%%textboxname%%', { lookupUrlPrefix: HawkSearch.HawkUrl + '/?fn=ajax&f=GetSuggestions', hiddenDivName: '', isAutoWidth: true }); HawkSearch.suggestInit('%%textboxnamefooter%%', { lookupUrlPrefix: HawkSearch.HawkUrl + '/?fn=ajax&f=GetSuggestions', hiddenDivName: '', isAbove: true }); }; //]]> </script> |
Autocomplete Integration:
The autocomplete feature can be integrated through API similar to the search functionality. Hawksearch sends the response in JSON format which can be consumed by your website and displayed appropriately.
Request: GET request made through a URL built as follows:
https://DOMAIN_URL/ENGINE_NAME/?fn=ajax&f=GetSuggestions&q=KEYWORD&hawkoutput=json
Parameter | Description | Value |
---|---|---|
fn | Indicates ajax request | ajax |
f | The function name to be called | GetSuggestions |
q | The keyword. This is the text typed by the user | user-entered alphanumeric value |
hawkoutput | Indicates the format of the response | json |
Response: Response is a JSON object sent back to the caller.
Expand | |||||
---|---|---|---|---|---|
| |||||
|
Parameter | DataType | Details |
---|---|---|
Count | Numeric | Total products available for the keyword |
ContentCount | Numeric | Total content items available for the keyword |
Categories | Array of Category Objects | Every category object is a category suggestion: |
Products | Array of Product | Based on the request parameter DisplayFullResponse, the product object has all its fields output or the standard autocomplete format |
Content | Array of Content Item Objects | Array of content item objects with Value and url properties. |
Popular | Array of Popular Searches | Every popular search term object is an object with these two properties: |
SearchWebsiteUrl | Url | Base website url for clickable links. |
TrackingVersion | Alphanumeric text of size 2 | v1 or v2 based on your engine version |
KeywordField | Alphabetic | Parameter used to denote the keyword field |
CategoryHeading | Alphanumeric | Header text for Categories |
ContentHeading | Alphanumeric | Header text for Content Items |
ProductHeading | Alphanumeric | Header text for Products |
PopularHeading | Alphanumeric | Header text for Popular Searches |
ViewAllButtonLabel | Alphanumeric | Header text for “View All” link |
Example URLs for various environments as follows:
Environment | Environment URL |
---|---|
Dev | https://dev.hawksearch.net/sites/demo/?fn=ajax&f=GetSuggestions&q=coat&hawkoutput=json |
Test | https://test.hawksearch.net/sites/demo/?fn=ajax&f=GetSuggestions&q=coat&hawkoutput=json |
Production | https://lusearchapi-na.hawksearch.com/sites/demo/?fn=ajax&f=GetSuggestions&q=coat&hawkoutput=json Note: if you have been provided with a custom domain such as yoursite.hawksearch.com, please replace lusearchapi-na.hawksearch.com in the above url with your custom domain URL. |
...
HTTP/Keep-Alive
In the event that you see unexpected timeout errors from the site when testing, please confirm your http web request settings for the request you make to hawksearch. In some cases, the clients reset the connection instead of leaving it in Time_Wait/Close_Wait causing IIS to log it as an interruption. In this scenario please force the request to be Http 1.0 with no keep alive and see if timeouts no longer appear.
...