Skip to main content

Integration using the platform's Algolia Search index

In this approach, the system uses the platform's API to search, filter and categorize products, storing only information about customers and their orders.

Pros

  • Simplified data management as product information is not stored locally.
  • Always up-to-date product data as it is requested directly from the API.

Integration steps

1. Initialization

  • Setting up an API for client to interact with the platform.
  • Set up parameters for authentication.
info

Please contact technical support to get credentials and access!
In addition you can ask your account manager

We recommend using the open source library to search for products InstantSearch.js and provide compatible search index.

The library is available for all major platforms and frameworks.

Implementation example for React:

import React from "react";
import ReactDOM from "react-dom";
import { SearchBox } from "react-instantsearch-dom";
import TypesenseInstantSearchAdapter from "typesense-instantsearch-adapter";

const typesenseInstantsearchAdapter = new TypesenseInstantSearchAdapter({
server: {
apiKey: GTS_API_SEARCH_ONLY_API_KEY,
nodes: [
{
host: GTS_API_HOST,
port: GTS_API_PORT,
protocol: GTS_API_PROTOCOL,
}
],
numRetries: 8,
connectionTimeoutSeconds: 1
},
additionalSearchParameters: {
query_by: 'name,categories,brand',
sort_by: 'price_amount:asc',
query_by_weights: '4,3,2',
},
});

const searchClient = typesenseInstantsearchAdapter.searchClient;

function Products(props: any) {
return (
<InstantSearch
searchClient={typesenseInstantsearchAdapter.searchClient}
indexName={PRODUCTS_COLLECTION}
>
<Configure
analytics={true}
hitsPerPage={48}
/>

// Your view components here
</InstantSearch>
);
}

export default Products;

Current schema index:

{
"name": "products",
"num_documents": 0,
"fields": [
{
"name": "name",
"type": "string",
"facet": false
},
{
"name": "description",
"type": "string",
"facet": false
},
{
"name": "brand",
"type": "string",
"facet": true
},
{
"name": "images",
"type": "string[]",
"facet": false
},
{
"name": "sizes",
"type": "string[]",
"facet": true,
"optional": true
},
{
"name": "categories",
"type": "string[]",
"facet": true
},
{
"name": "categories.lvl0",
"type": "string[]",
"facet": true
},
{
"name": "categories.lvl1",
"type": "string[]",
"facet": true,
"optional": true
},
{
"name": "categories.lvl2",
"type": "string[]",
"facet": true,
"optional": true
},
{
"name": "categories.lvl3",
"type": "string[]",
"facet": true,
"optional": true
},
{
"name": "categories.lvl4",
"type": "string[]",
"facet": true,
"optional": true
},
{
"name": "price_amount",
"type": "float",
"facet": true
}
],
"default_sorting_field": "price_amount"
}
info

An example has been prepared by the developers of this library available here

tip

All kinds of widgets and functions in the user interface can be viewed here

3. Request for detailed product info

  • Executing GET request to an API endpoint with a product ID to get detailed information.

4. Create order

  • Set up a request body to create an order, including data about the customer and selected products.
  • Send POST request to API create and order.

6. Get order status

  • Execute GET request to retrieve the status by order ID.