Portal - Full Text Search Web Service

crates.io

Purpose

The purpose of this service is to be your full text search web service for JavaScript front-ends like React with fetch.

Portal is a full replacement for ElasticSearch and MeiliSearch. These services are either too complex, too resource hungry, and/or too slow.

Portal is built to be simple and fast as possible with JWT verification, indexing, deindexing, search, and suggest.

Indexing is batch indexing by default.

To use this service you need to have running sonic server and a broker server.

Features

Use

Index

html POST /index - authenticated endpoint (Authorization: Bearer {jwt}) example: json { "items": [{ "collection": "coffee", "bucket": "tenant_1", "id": "49e28aae-88d4-4c19-86d8-51f2c9f11039", "data": { "name": "roasted", "image": "https://img.com/bucket/123/123.jpg" }, "locale": "eng", "indexes": ["name"] }] } - note: locale is an optional field of an ISO 639-3 locale code - if not defined locale will be auto-detected

will return: 200 or 500 or 400 or 401

Search

html POST /search - authenticated endpoint (Authorization: Bearer {jwt}) json { "collection": "coffee", "bucket": "tenant_1", "query": "roasted", "limit": 10, "offset": 10 } - note: limit and offset are optional fields

will return: 200 or 500 or 400 or 401

200 - will return an array of objects json [ { "collection": "coffee", "bucket": "tenant_1", "id": "49e28aae-88d4-4c19-86d8-51f2c9f11039", "data": { "name": "roasted", "image": "https://img.com/bucket/123/123.jpg" }, "locale": "eng", "indexes": ["name"] } ]

Suggest

html POST /suggest - authenticated endpoint (Authorization: Bearer {jwt}) json { "collection": "coffee", "bucket": "tenant_1", "query": "r", "limit": 10 } - note: limit is an optional field

will return: 200 or 500 or 400 or 401

200 - will return an array of words (strings) json ["roasted"]

Deindex

html POST /deindex - authenticated endpoint (Authorization: Bearer {jwt}) json { "ids": ["49e28aae-88d4-4c19-86d8-51f2c9f11039"] }

will return: 200 or 500 or 400 or 401

Install

cargo install portal

TechStack

Inspiration