...
Call this method when you want to make search requests to the Hawkseach API.
Autocomplete
...
The Autocomplete method exposes a functionality for autocompleting search request depending on input.
Code Block |
---|
|
AutocompleteResult Autocomplete(AutocompleteQuery query) |
Parameters
This is the data which is expected in order to make a successful autocomplete request
Expand |
---|
title | AutocompleteQuery properties |
---|
|
Code Block |
---|
public string ClientGuid { get; set; }
public string Keyword { get; set; }
public string IndexName { get; set; }
public string Type { get; set; }
public long ProductCount { get; set; }
public bool DisplayFullResponse { get; set; }
public string[] FieldOverride { get; set; }
public ClientData ClientData { get; set; } |
|
The mandatory ones are ClientGuid
, Keyword
, IndexName
, DisplayFullResponse
.
Returns
The Hawksearch API returns a response message which is mapped to object of type AutocompleteResult
Expand |
---|
title | AutocompleteResult properties |
---|
|
Code Block |
---|
public long Count { get; set; }
public long ContentCount { get; set; }
public List<Category> Categories { get; set; }
public List<Product> Products { get; set; }
public List<object> Content { get; set; }
public List<object> Popular { get; set; }
public string SearchWebsiteUrl { get; set; }
public string KeywordField { get; set; }
public string CategoryHeading { get; set; }
public string ContentHeading { get; set; }
public string ProductHeading { get; set; }
public string PopularHeading { get; set; }
public string ViewAllButtonLabel { get; set; } |
|
The actual autocomplete results are mapped to a List<Product> Products
Expand |
---|
|
Code Block |
---|
public string ProductName { get; set; }
public string Thumb { get; set; }
public string Url { get; set; }
public string Html { get; set; }
public Result Results { get; set; } |
|
And the data for each result is mapped to an object of type Result
Expand |
---|
|
Code Block |
---|
public Guid DocId { get; set; }
public long Score { get; set; }
public Dictionary<string, List<string>> Document { get; set; }
public Redirect BestFragments { get; set; }
public bool IsPin { get; set; } |
|
Usage
Call this method when you want to enhance your UI by