Skip to content

A CLI utility to import Algolia's query rules JSON into Typesense

Notifications You must be signed in to change notification settings

typesense/algolia-query-rules-to-typesense

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

algolia-query-rules-to-typesense

This is a simple CLI utility to convert query rules from Algolia to Typesense's Override API JSON.

Usage:

npx algolia-query-rules-to-typesense <path/to/algolia_rules_export.json> <path/to/typesense_overrides_output.json>

To get algolia_rules_export.json, go to the "Rules" section of your Algolia index, and you'll find a download icon to export the rules as JSON.

This is the expected format of algolia_rules_export.json:

[
  {
    "description": "Test Rule",
    "conditions": [
      {
        "anchoring": "is",
        "pattern": "keyword",
        "alternatives": true
      }
    ],
    "consequence": {
      "params": {
        "filters": "..."
      },
      "filterPromotes": true
    },
    "enabled": true,
    "objectID": "qr-1682441011"
  }
]

After running this command, the output JSON will be in this format:

[
  {
    "id": "Test Rule - qr-1682441011",
    "rule": {
      "query": "keyword",
      "match": "exact"
    },
    "filter_curated_hits": true,
    "filter_by": "..."
  }
]

You can then import these JSON rules into Typesense using the Typesense API.

About

A CLI utility to import Algolia's query rules JSON into Typesense

Resources

Stars

Watchers

Forks

Sponsor this project

 

Packages

No packages published