We recently completed a feature for a customer that allowed us to use a relatively new offering from Microsoft Azure. Like any new technology, we wanted to justify the weight of learning the technology with the benefits it would provide over our current toolset. Enter: Azure Search, which solved many of our problems and introduced us to a new way of thinking about cloud-based services.

The Problem

Our customer had a rather simple problem - present their entire catalog of items on a website. While the use case seemed trivial, the feature set was extensive. In addition to viewing the catalog, users needed to:

  • Browse items by Category
  • Filter items
  • Perform full-text searches

Most importantly, with plans for heavy web and mobile traffic, searches needed to be fast!

Having built similar features in the past, we knew a basic solution to this problem would involve an interface over a database of items, hosted by our flavor of database (SQL Server). This would accomplish most of our bullet points, with some limitations. We know that SQL Server is great for enterprise apps. It is quick to store business objects, and fetch them on demand. SQL Server has a tipping point though when it comes to textual analysis and searching, dynamic querying, and multi-attribute filtering. Knowing that our customer needed a highly-scalable solution to support tens to hundreds of thousands of users, we knew searching against SQL Server would be limiting.

Being fully invested in Azure, and the entirety of Microsoft’s cloud offering, we turned to their product set to solve the problem. We were excited when we happened upon Microsoft’s exact solution to this problem: Azure Search. Microsoft describes Azure Search as

a search-as-a-service cloud solution that gives developers APIs and tools for adding a rich search experience over your data.”

After researching the product, it was apparent that Azure Search would fulfill our needs, and more. We immediately we began to harness the new technology. Like any Azure offering, Azure Search was easy to create and have up and running within minutes. Azure Search provides a free tier that offers ample storage space and performance for development. We then outlined the data we needed to search upon, and constructed our search indexes - which consist of a schema representing the data, and whether each property should be searchable, sortable, filterable, facetable, etc. Azure even suggested that we index every column for simplicity. Doing so in SQL Server would quickly make you a database admin’s worst enemy…

Once our data was in Azure Search, we used the libraries provided by Microsoft to execute our searches against Azure Search. Things were very intuitive from the start. We were able to ask Azure Search for category counts, perform full-text searches across all fields of our data, filter our data, sort, and page - with very little code written.

Benefits

After using Azure Search for a period of time, many benefits to our decision became clear.

Powerful Searches. Of course, Azure Search will handle the simplest searching and filtering without hesitation. One can quickly filter on columns or arrays, use “contains” searches, and even filter within geographical boundaries. In addition, Azure Search supports search queries using the well-known Lucene query syntax. This provides further functionality to use search using wildcards and fuzzy searching. This makes it possible for a user to find what they are looking for, even if they may have mistyped their search.

Reduced Complexity. Azure Search made it very easy to build any combination of searching and filtering against our data set. Building a similar query against a SQL database is possible, but is cumbersome and does not lend itself to future expansion.

Scalability. Just as other Azure offerings are scalable at the push of a button, Azure Search can scale almost immediately. One can control the number of replicas within the search service to provide better performance with larger search loads. Azure also allows for partitioning of search data, which allocates more document storage within Azure Search. We did not explore partitioning, as one partition was enough for our use case.

Lower Database Traffic. By leveraging Azure Search, we were able to move all search traffic (which is often very database-intensive) to a dedicated service, reducing the overhead on our database. The database will be able to fulfill more single-item requests (like viewing a product in a catalog), with Azure Search handling the heavier work (showing all products that are the color red).

Analytics Suite. Azure Search also provides extensive insights into how the data is being searched, including searches per day, the most common search terms, and zero-result searches. These analytics can help a business to realize the most popular things customers are searching for. Or, they can use zero-result searches to guide their business to better suit their customer base. Moreover, analytics can be consumed within Microsoft’s Power BI tool for further exploration.

Azure Search is an impressive offering from Microsoft that will help any business to offer feature-rich searching to their customers. It has far exceeded our expectations with regards to ease of use, setup time, and overall functionality. With its added benefits including scalability and search analytics, it is hands-down the best tool for the job. We highly recommend Azure Search to anyone offering search features within their apps and websites.

Posted Mon 11 September 2017