https://github.com/simonwhitaker/bard-a-bing
https://github.com/simonwhitaker/bard-a-bing
Last synced: 3 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/simonwhitaker/bard-a-bing
- Owner: simonwhitaker
- Created: 2023-02-22T10:08:27.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2023-02-22T21:52:36.000Z (over 3 years ago)
- Last Synced: 2025-01-01T02:41:04.322Z (over 1 year ago)
- Language: Python
- Size: 3.91 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Bard-a-Bing!
A search engine for Shakespeare sonnets, powered by [Meilisearch](https://www.meilisearch.com/).
## Getting started
1. Generate a local JSON document containing the Shakespeare sonnets as per-line data elements:
```command
curl -s https://ocw.mit.edu/ans7870/6/6.006/s08/lecturenotes/files/t8.shakespeare.txt \
| ./pre-process.py > sonnets.json
```
2. Run a Meilisearch instance locally using docker compose:
```command
docker compose up -d
```
3. Load the documents into your search index:
```command
curl \
-X POST 'http://localhost:7700/indexes/sonnets/documents?primaryKey=id' \
-H 'Content-Type: application/json' \
--data-binary @sonnets.json
```
4. Open http://localhost:7700 and search! Or query using cURL or (my favourite) [HTTPie](https://httpie.io/), like this:
```command
http --body localhost:7700/indexes/sonnets/search q=compare+thee limit:=1
```
Which returns:
```json
{
"estimatedTotalHits": 1,
"hits": [
{
"id": 239,
"line_number": 1,
"sonnet_number": 18,
"text": "Shall I compare thee to a summer's day?"
}
],
"limit": 1,
"offset": 0,
"processingTimeMs": 0,
"query": "compare+thee"
}
```