No description
  • Rust 97.4%
  • Dockerfile 2.6%
Find a file
alexohneander 6ca8901f1d
Some checks failed
Rust / build (push) Failing after 1m53s
Coverage / coverage (push) Has been cancelled
Update .github/workflows/rust.yml
2026-01-14 23:53:38 +00:00
.github Update .github/workflows/rust.yml 2026-01-14 23:53:38 +00:00
src feat: add Docker build pipeline 2024-12-19 17:49:22 +01:00
tests refactor: type config tests 2024-12-19 11:31:27 +01:00
.gitignore feat: add .vscode/launch.json to .gitignore 2024-02-13 18:01:52 +01:00
Cargo.lock feat: write index to disk 2024-12-16 17:02:31 +01:00
Cargo.toml feat: write index to disk 2024-12-16 17:02:31 +01:00
codecov.yml feat: Add codecov configuration 2023-10-26 09:30:36 +02:00
Dockerfile feat: add Docker build pipeline 2024-12-19 17:49:22 +01:00
LICENSE Initial Commit 2023-10-24 20:15:03 +02:00
README.md fix: liniting errors 2024-12-17 10:21:17 +01:00

Rust codecov

RustySearch

This project is a simple implementation of a search engine in Rust. It uses the BM25 algorithm for ranking documents. This project is a learning exercise and is not intended for production use.

Todo

  • Store index to Disk
  • Save multiple Indecies
  • Benchmark the Index/SearchEngine

Features

  • Indexing documents: The search engine maintains an index of documents, where each document is associated with a unique identifier.
  • Searching: Given a query, the search engine returns the most relevant documents.
  • BTree: The index is saved as a BTreeMap on the hard disk and loaded from the hard disk into RAM when the system is started.

Usage

Dev Setup/Usage

cargo run

Add Document to Index:

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:

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:

  • k1: The k1 parameter of the BM25 algorithm.
  • b: The b parameter of the BM25 algorithm.

Project Structure

The main components of the project are:

  • SearchEngine: This is the main class that provides the functionality of the search engine.
  • index: A HashMap that stores the index of the documents.
  • documents: A HashMap that stores the documents with their unique identifiers.

Contributing

Contributions are welcome. Please submit a pull request.

License

This project is licensed under the MIT License.