Crates.io | portal |
lib.rs | portal |
version | 3.0.1 |
source | src |
created_at | 2020-01-20 16:31:09.134863 |
updated_at | 2021-05-01 01:03:16.037815 |
description | Full Text Search Web Service |
homepage | |
repository | https://github.com/apibillme/portal |
max_upload_size | |
id | 200483 |
size | 107,426 |
The purpose of this service is to be your full text search web service for any JSON client including JavaScript front-ends like React with fetch.
Portal is a competitor to ElasticSearch, MeiliSearch, AWS CloudSearch, AWS ElasticSearch Service, and Algolia.
Portal is built to be simple and blazing fast with JWT verification, indexing, deindexing, search, and word suggest.
Indexing is batch indexing by default.
To use this service you need to have a running sonic server and a broker server.
portal:full
or granular permissions portal:create_bucket, portal:delete_bucket, portal:index, portal:deindex, portal:search, or portal:suggest
POST /create_bucket
{
"collection": "coffee",
"name": "tenant_1"
}
will return: 200
or 500
or 400
or 401
POST /delete_bucket
{
"collection": "coffee",
"name": "tenant_1"
}
will return: 200
or 500
or 400
or 401
POST /index
{
"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"]
}]
}
will return: 200
or 500
or 400
or 401
note: only buckets the user has created can be used in the index call
note: locale
is an optional field of an ISO 639-3 locale code - if not defined the locale will be auto-detected
Supported Locales:
POST /search
{
"collection": "coffee",
"bucket": "tenant_1",
"query": "roasted",
"limit": 10,
"offset": 10
}
limit
and offset
are optional fieldswill return: 200
or 500
or 400
or 401
200 - will return an array of objects
[
{
"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"]
}
]
POST /suggest
{
"collection": "coffee",
"bucket": "tenant_1",
"query": "r",
"limit": 10
}
will return: 200
or 500
or 400
or 401
{
"suggestions": ["roasted"]
}
POST /deindex
{
"ids": ["49e28aae-88d4-4c19-86d8-51f2c9f11039"]
}
will return: 200
or 500
or 400
or 401
GET or HEAD /
will return: 200
cargo install portal
origin
can be passed in as a flag - default *
port
can be passed in as a flag - default 8888
- can only be set for unsecure connectionssecure
flag for https can be true or false - default false
auto_cert
flag for an autorenewing LetsEncrypt SSL cert can be true or false - requires a resolvable domain - default true
key_path
flag when auto_cert
is false
to set the SSL key path for your own cert - default certs/private_key.pem
cert_path
flag when auto_cert
is false
to set the SSL cert path for your own cert - default certs/chain.pem
certs
flag is the storage path of LetsEncrypt certs - default certs
db
flag is the path where the embedded database will be saved - default db
domain
flag is the domain name (e.g. api.broker.com) of the domain you want to register with LetsEncrypt - must be fully resolvablesonic_server
flag is the sonic domain/ip/port of the sonic server - default localhost:1491
sonic_password
flag is the sonic password set in the sonic config file - default SecretPassword
broker
flag is the broker domain/ip/port of the broker server - default http://localhost:8080
./portal --secure="true" --domain="index.broker.com" --sonic_server="sonic.broker.com" --sonic_password="wj34T%$Dx" --broker="https://broker.broker.com"
There is an example systemctl
service for Ubuntu called portal.service
in the code