Giter Site home page Giter Site logo

manticoresearch-typescript's Introduction

Manticore TypeScript client

Сlient for Manticore Search.

❗ WARNING: this is a development version of the client. The latest release's readme is https://github.com/manticoresoftware/manticoresearch-typescript/tree/3.3.1

Requirements

Minimum Manticore Search version is 4.2.1 with HTTP protocol enabled.

Manticore Search manticoresearch-typescript Node
>= 6.2.0 3.3.1 >= 18.0.0
>= 4.2.1 1.0.x >= 18.0.0

Installation

npm install manticoresearch-ts 

Getting Started

Please follow the installation instruction and execute the following typescript code:

import {
  Configuration,
  IndexApi,
  SearchApi,
  ResponseError,
} from "manticoresearch-ts/dist/src";
(async () => {
  try {
    /*
    const config = new Configuration({
      basePath: 'http://localhost:9308',
      // fetchApi: <your own fetch API> // use node-fetch with node version < 18
    })
    const indexApi = new IndexApi(config)
    */
    const indexApi = new IndexApi();
    const docs = [
      { insert: { index: "test", id: 1, doc: { title: "Title 1" } } },
      { insert: { index: "test", id: 2, doc: { title: "Title 2" } } },
    ];
    const insertResponse = await indexApi.bulk(
      docs.map((doc) => JSON.stringify(doc)).join("\n")
    );
    console.info("Insert response:", JSON.stringify(insertResponse, null, 2));

    const searchApi = new SearchApi();
    const searchResponse = await searchApi.search({
      index: "test",
      query: { query_string: "Title 1" },
    });
    console.info("Search response:", JSON.stringify(searchResponse, null, 2));
  } catch (error) {
    const errorResponse =
      error instanceof ResponseError ? await error.response.json() : error;
    console.error("Error response:", JSON.stringify(errorResponse, null, 2));
  }
})();

Documentation

Full documentation on the API Endpoints and Models used is available in docs folder as listed below.

Manticore Search server documentation: https://manual.manticoresearch.com.

Documentation for API Endpoints

All URIs are relative to http://127.0.0.1:9308

Class Method HTTP request Description

| Manticoresearch.IndexApi | bulk | POST /bulk | Bulk index operations |

| Manticoresearch.IndexApi | delete | POST /delete | Delete a document in an index |

| Manticoresearch.IndexApi | insert | POST /insert | Create a new document in an index |

| Manticoresearch.IndexApi | replace | POST /replace | Replace new document in an index |

| Manticoresearch.IndexApi | update | POST /update | Update a document in an index |

| Manticoresearch.SearchApi | percolate | POST /pq/{index}/search | Perform reverse search on a percolate index |

| Manticoresearch.SearchApi | search | POST /search | Performs a search on an index |

| Manticoresearch.UtilsApi | sql | POST /sql | Perform SQL requests |

Documentation for Authorization

All endpoints do not require authorization.

manticoresearch-typescript's People

Contributors

angpuosyer 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.