Add search to an application with the new Azure Cognitive Search SDK

Add search to an application with the new Azure Cognitive Search SDK

This blog post will walk you through the process of building and deploying a simple search application with Azure Cognitive Search and the new Azure SDK for Javascript/Typescript. We’ll first create an Azure Function to encapsulate the search client and query logic.

If you’ve ever used an application that didn’t include search functionality, you’ll know how important search is to help you find what you’re looking for. Whether you’re building an e-commerce site, an internal website for your company, or any other type of application, it’s important to help users quickly find what they’re looking for and search does just that.

With Azure Cognitive Search and the Azure SDKs, you can build a search application from scratch or infuse search into an existing application in just a few minutes. This blog post will walk you through the process of building and deploying a simple search application with Azure Cognitive Search and the new Azure SDK for Javascript/Typescript. We’ll first create an Azure Function to encapsulate the search client and query logic. After that, we’ll deploy a React template using Azure Static Web Apps to integrate our Azure Functions with a front-end.

This sample uses a demo search service and index hosted by Microsoft. To use this sample, you just need an IDE and access to an Azure subscription.

By the end of this post, you’ll know how to deploy a sample application that looks like this:

Screenshot of the web app

You can find the full code for this blog post at: aka.ms/search-react-template.

You can find the demo website at: aka.ms/azs-good-books.

Thinking through the search user experience

At a high level, there are three pieces of search functionality we need to add to an application to provide an intuitive search experience.

  1. Search – provides search functionality for the application.
  2. Suggest – provides suggestions as the user is typing in the search bar.
  3. Document Lookup – looks up a document by id to retrieve all of its contents for the details page.

azure sdk azure cognitive search azure functions azure static web apps javascript

Bootstrap 5 Complete Course with Examples

Bootstrap 5 Tutorial - Bootstrap 5 Crash Course for Beginners

Nest.JS Tutorial for Beginners

Hello Vue 3: A First Look at Vue 3 and the Composition API

Building a simple Applications with Vue 3

Deno Crash Course: Explore Deno and Create a full REST API with Deno

How to Build a Real-time Chat App with Deno and WebSockets

Convert HTML to Markdown Online

HTML entity encoder decoder Online

Implement a full text search using Azure Cognitive Search in ASP.NET Core

This article shows how to implement a full text search in ASP.NET Core using Azure Cognitive Search. The search results are returned using paging and the search index can be created, deleted from a…

TodoMVC Full Stack with Azure Static Web Apps, Node and Azure SQL

This article is part of #ServerlessSeptember. You’ll find other helpful articles, detailed tutorials, and videos in this all-things-Serverless content collection. New articles from community members and cloud advocates are published every week from Monday to Thursday through September.

How long does it take to develop/build an app?

This article covers A-Z about the mobile and web app development process and answers your question on how long does it take to develop/build an app.

Getting started with Azure Static Web Apps | Azure Tips and Tricks

In this video, you'll learn how to get started with Azure Static Web Apps. For more tips and tricks, visit: https://aka.ms/azuretipsandtricks Get started wit...

Progressive Web Apps or Native Apps, Tips to choose the best for your app in 2020

Progressive Web Apps or Native Apps, if you are in a dilemma of selecting the better one for your requirements these pointers will help make an informed decision.