High-performance Rust search engine for RAG systems
Project description
son-logic-engine
High-performance search filter for RAG systems written in Rust, designed for speed and accuracy with Vietnamese text.
🚀 Features
- Rust Core: Blazing fast processing for large datasets.
- Polymorphic Input: Supports
List[str],Dict, or nestedList[Dict]. - Field Filtering: Optimize search speed by targeting specific columns.
- Unicode Support: Native handling of Vietnamese characters and custom character mappings.
🛠 Installation
pip install son-logic-engine
📖 API Reference
1. load_mapping(path: str)
Loads the character weight mapping from a JSON file. This is required for the search logic to compute character-based relevance.
import son_logic_engine as slg
mapping = slg.load_mapping('path/to/mapping.json')
2. loc(query: str, database: Any, mapping: dict, field_name: str = None)
The core search function. Returns a list of records (as JSON strings) ranked by relevance to the query.
query: The search term.database: Your data (List of strings or List of Dictionaries).mapping: The mapping object fromload_mapping.field_name: (Optional) The specific key in your dictionary to search within.
Python-side Utility: slg.print(raw_results: list)
This is a notebook-defined helper function designed to pretty-print the JSON results returned by loc in a readable format within a Python environment. It is not part of the core Rust library distributed via PyPI.
# Example of how you might define and use a similar helper in Python
import json
def slg_print_helper(raw_results):
if not raw_results:
print("Không tìm thấy kết quả nào.")
return
for i, item_json in enumerate(raw_results):
try:
data_obj = json.loads(item_json)
print(f"[Hạng {i+1}]")
print(json.dumps(data_obj, indent=4, ensure_ascii=False))
print("---" * 10)
except Exception as e:
print(f"Lỗi khi giải mã kết quả thứ {i+1}: {e}")
# Assuming `slg` is imported and `raw_results` are from `slg.loc`
# slg_print_helper(raw_results)
🔒 Security & Contact
The underlying search algorithm and character weight logic are proprietary. For access to standard mapping files or custom integration, please contact:
📩 Email: sonbuwin@gmail.com
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file son_logic_engine-0.2.5.tar.gz.
File metadata
- Download URL: son_logic_engine-0.2.5.tar.gz
- Upload date:
- Size: 7.1 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
abbbeb5b0f0508f315a1c5cee8f380be4ef508a7918fd0ca8f625b7f6df01402
|
|
| MD5 |
7d65ffc5a2d1336592f4a6ed706aebba
|
|
| BLAKE2b-256 |
4848c3e207cf8226ec81af7b89e49749834e1267bd4df1003093d6005ca47658
|
File details
Details for the file son_logic_engine-0.2.5-cp312-cp312-manylinux_2_34_x86_64.whl.
File metadata
- Download URL: son_logic_engine-0.2.5-cp312-cp312-manylinux_2_34_x86_64.whl
- Upload date:
- Size: 317.6 kB
- Tags: CPython 3.12, manylinux: glibc 2.34+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
67de38e91f79ffec9fb7cf32086aad0938842116e0e240c5695c4bc87a01761c
|
|
| MD5 |
980d00e556b645a12b56aeacf13eca37
|
|
| BLAKE2b-256 |
15e827ef339dcfc6d7ea432aa969617a982a4f712384dede526adb0d5513f8f8
|