One of the more common requests I hear (and quite obvious gap in my opinion) is the support for suggestions when using Azure Search. Auto-suggestions are supported when using Solr as of 9.0.1 (and SXA supports this in the Search Box rendering parameters) and Azure has both Suggestions and Autocomplete APIs.
I recently had the opportunity to take a crack at this missing feature, which I based off the SXA implementation.
Code is in my GitHub Sitecore-AzureSearch-Suggestions repo.
There are 3 branches:
- The master branch contains the simplest implementation, however uses Azure Search binaries from NuGet, and has a dependency on SXA.
- The no-azure-client branch does not use the Azure Search binaries but makes API calls directly like the rest of the Sitecore Azure Search implementation
- The no-sxa branch contains the implementation with Azure binaries, but no SXA dependency
Unfortunately the Sitecore Azure Search dlls (
Sitecore.ContentSearch.Azure.*
) do not seem to be as extensible as the rest of sitecore, as there are numerous internal classes and private methods/properties.The following classes had to pretty much be copied out as they couldn't be extended :(
Sitecore.ContentSearch.Azure.Http.SearchService
Sitecore.ContentSearch.Azure.Http.SearchServiceClient
properties +GetClient
methodSitecore.ContentSearch.Azure.Http.CompositeSearchService
Sitecore.ContentSearch.Azure.CloudSearchProviderIndex
ConnectionStringName,
SearchCloudIndexName
propertiesSitecore.ContentSearch.Azure.CloudSearchProviderIndexName
Sitecore.ContentSearch.Azure.ISwitchSearchIndexInitializable
Sitecore.ContentSearch.Azure.Schema.CloudSearchIndexSchema
Sitecore.ContentSearch.Azure.Http.MultiStatusResponseDocument
- All
Sitecore.ContentSearch.Azure.Http.Exceptions
exceptions Sitecore.ContentSearch.Azure.Exception.CloudSearchCompositeSearchServiceException
Sitecore.ContentSearch.Azure.Exception.CloudSearchMissingImplementationException
Oh and I found a couple of typos while I was in there ;)
Sitecore.ContentSearch.Azure.Utils.Retryer.IRertyPolicy
- /sitecore/media library/Base Themes/SearchTheme/Scripts/component-search-box
return '<div class="sugesstion-item">' + suggestionText + '</div>';
No comments:
Post a Comment