https://github.com/aberba/meilisearch
A MeiliSearch API for D
https://github.com/aberba/meilisearch
Last synced: about 1 month ago
JSON representation
A MeiliSearch API for D
- Host: GitHub
- URL: https://github.com/aberba/meilisearch
- Owner: aberba
- License: bsl-1.0
- Created: 2020-12-18T00:17:05.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2020-12-28T22:23:27.000Z (over 4 years ago)
- Last Synced: 2024-11-14T11:39:37.650Z (7 months ago)
- Language: D
- Size: 170 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE_1_0.txt
Awesome Lists containing this project
- awesome-meilisearch - D - A Meilisearch API for D (Integrations / Community Integrations)
README
# A MeiliSearch API for D
[MeiliSearch](https://meilisearch.com) is a lightweight and fast search engine with a RESTfull search API. It's a modern alternative to elasticsearch and co.
### Usage
Downalod and run MeiliSearch in your command-line with `./meilisearch --master-key YOUR_KEY_HERE`> Note: this API used [requests](https://code.dlang.org/packages/requests) for handling HTTP request and so all responses are of type `Response`.
```d
import std.stdio;
import meilisearch;
import requests: Response;void main()
{
// Use your own host and master key
// See https://docs.meilisearch.com/guides/advanced_guides/authentication.html#api-key
auto client = new Client("http://127.0.0.1:7700", "YOUR_KEY_HERE");
auto index = client.createIndex("users");Response r = index.health();
writeln("code ", r.code);
writeln("body ", r.responseBody);Response r2 = index.addDocuments(`[{"id":"1", "name":"Car"}, {"id":"2", "name":"Bike"}]`);
writeln("code ", r2.code);
writeln("body ", r2.responseBody);Response r3 = index.search(`Car`);
writeln("code ", r3.code);
writeln("body ", r3.responseBody);
}
```