feat: add post request to save document and search query endpoints
This commit is contained in:
parent
760a4f86e3
commit
627937a2f7
26
README.md
26
README.md
@ -9,7 +9,8 @@ This project is a learning exercise and is not intended for production use.
|
||||
## Todo
|
||||
|
||||
- [x] Store index to Disk
|
||||
- [ ] Save multiple indecies
|
||||
- [ ] Save multiple Indecies
|
||||
- [ ] Benchmark the Index/SearchEngine
|
||||
|
||||
### Features
|
||||
|
||||
@ -19,6 +20,29 @@ This project is a learning exercise and is not intended for production use.
|
||||
|
||||
### Usage
|
||||
|
||||
#### Dev Setup/Usage
|
||||
|
||||
```bash
|
||||
cargo run
|
||||
```
|
||||
|
||||
**Add Document to Index:**
|
||||
```bash
|
||||
curl --request POST \
|
||||
--url http://localhost:4000/search/index/document \
|
||||
--header 'Content-Type: application/json' \
|
||||
--data '{
|
||||
"url": "https://de.wikipedia.org/wiki/Rust_(Programmiersprache)",
|
||||
"content": "Rust ist eine Multiparadigmen-Systemprogrammiersprache, die von der Open-Source-Community entwickelt wurde und unter anderem von Mozilla Research gesponsert wird.[12] Sie wurde mit dem Ziel entwickelt, sicher, nebenläufig und praxisnah zu sein.[13] Sicherheit bezieht sich dabei insbesondere auf die Vermeidung von Programmfehlern, die zu Speicherzugriffsfehlern oder Pufferüberläufen und damit unter Umständen auch zu Sicherheitslücken führen, vor allem auch in nebenläufigen Prozessen. Im Gegensatz zu anderen Programmiersprachen mit automatischer Speicherverwaltung verwendet Rust hierfür keine Garbage Collection, sondern ein besonderes Typsystem. Dessen Typsicherheit wurde formal bewiesen."
|
||||
}'
|
||||
```
|
||||
|
||||
**Search Query:**
|
||||
```bash
|
||||
curl --request GET \
|
||||
--url 'http://localhost:4000/search?query=Rust'
|
||||
```
|
||||
|
||||
#### Creating a new instance of SearchEngine
|
||||
|
||||
You can create a new instance of the SearchEngine with the new function. It takes two parameters:
|
||||
|
Loading…
x
Reference in New Issue
Block a user