Giter Club home page Giter Club logo

search-ui-azure-connector's Introduction

search-ui-azure-connector

This connector is used to connect Search UI to Azure Cognitive Search. Checkout the live demo of Search UI with Azure Cognitive Search, or have a look at the React sample.

Getting started

Install React Search UI and the Azure Cognitive Search connector.

npm install --save @elastic/react-search-ui search-ui-azure-connector
import { AzureCognitiveSearchConnector } from "search-ui-azure-connector";

// We'll connect to the Azure Cognitive Search public sandbox and send a query
// to its "nycjobs" index built from a public dataset of available jobs in New York
// https://www.npmjs.com/package/@azure/search-documents#send-your-first-search-query
const connector = new AzureCognitiveSearchConnector({
  endpoint: "https://azs-playground.search.windows.net/",
  queryKey: "252044BE3886FE4A8E3BAA4F595114BB",
  indexName: "nycjobs",
});

<SearchProvider
  config={{
    apiConnector: connector,
  }}
>
  <div className="App">{/* Place Components here! */}</div>
</SearchProvider>;

If you would like to connect to your own Azure Cognitive Search instance, make sure to use the query key and not the admin key.

Configuration

All configuration for Search UI is provided in a single configuration object, as documented here.

This connector supports the configuration possibilities of Search UI for filters, facets, autocomplete and suggestions. Specific Azure Cognitive Search configuration possibilities are documented below.

Set custom suggester

By default, the connector uses sg as the suggester name for autocomplete and suggestions. If you want to specify a custom suggester name, add the suggester property to the results and/or suggestions config.

{
  "autocompleteQuery": {
    "results": {
      "suggester": "sg"
    },
    "suggestions": {
      "suggester": "sg"
    }
  }
}

Set Autocomplete Mode

The Autocomplete API supports three different modes. The default mode is oneTerm. You can add the autocompleteMode property to the results config, to change the Autocomplete Mode.

{
  "autocompleteQuery": {
    "results": {
      "autocompleteMode": "twoTerms" // oneTerm, twoTerms or oneTermWithContext
    }
  }
}

If you specify fields in result_fields, make sure they exist in your suggester.

Limitations

This connector does not support all the functionality offered by Search UI. The following features are not (yet) supported.

  • Facet search
  • autocompleteQuery does not take results per page into account
  • Search UI doesn't offer a 'detail page' currently, just the search overview

Sample

A sample using the more advanced features of Search UI can be found here, built via Create React App. Checkout the live demo of Search UI with Azure Cognitive Search or have a look at the code sandbox.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.