GithubHelp home page GithubHelp logo

isabella232 / algolia-combinatory-match Goto Github PK

View Code? Open in Web Editor NEW

This project forked from algolia/algolia-combinatory-match

0.0 0.0 0.0 48 KB

An Algolia tool to match and get known entities in your query

JavaScript 100.00%

algolia-combinatory-match's Introduction

Algolia Combinatory Match

An Algolia tool to match and get known entities in your query

Installation

  • > npm install -S algolia-combinatory-match OR
  • > yarn add algolia-combinatory-match

Usage

import AlgoliaCombinatoryMatch from 'algolia-combinatory-match';

const algoliaCombinatoryMatch = new AlgoliaCombinatoryMatch(
  'APP_ID',
  'API_KEY',
  [
    { name: 'indexName1', attribute: 'attributeName1' },
    { name: 'indexName2', attribute: 'attributeName2' },
  ]
);

async function main() {
  const result = await algoliaCombinatoryMatch.run(
    'find an american restaurant in manhattan'
  );
}

The result will be an object of this format:

{
  results: [ [], [] ],
  matches: [
    { hit: [Object], index: 'cuisines', matchedWords: 'american' },
    { hit: [Object], index: 'boroughs', matchedWords: 'manhattan' }
  ]
}

With

  • results the search results of indexName1 and indexName2
  • matches the detect entities in the query

Documentation

AlgoliaCombinatoryMatch(appId: string, apiKey: string, indices: Array<{ name: string, attribute: string }>)

Create a new AlgoliaCombinatoryMatch instance.

All the following methods should be used on this instance.

run(query: string, check: ?(string, any) => boolean)

Run the combinator. check is a optional function that will decide whether the combination string should match the hit any. By default, it will match if hit._highlightResult[this.attribute].fullyHighlighted is true.

expandStopWords(stopWords: Array<string>)

Expand the default english language stopwords list.

setStopWords(stopWords: Array<string>)

Set a new stopwords list instead of the default english language one.

algolia-combinatory-match's People

Contributors

utay avatar

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.