4 releases (2 breaking)
new 0.3.0 | Jan 24, 2025 |
---|---|
0.2.1 | Jan 22, 2025 |
0.2.0 | Jan 4, 2025 |
0.1.0 | Dec 25, 2024 |
#61 in Database implementations
403 downloads per month
47KB
825 lines
Attribute Search Engine
Attribute Search Engine is a generic search engine for rows consisting of attributes, that can be searched using different matchers.
Warning: This project is not finished yet and the public interface may change.
- Rows
- Attributes
- ExactMatch (HashMap)
- PrefixMatch (PrefixTree/Trie) (Strings only)
- RangeMatch (BTreeMap)
- Attributes
- Queries
- Are in CNF (Conjunctive Normal Form)
Example:
+name:Hans,Peter +age:25-35 -lastname=Doe
Means:(name=Hans || name==Peter) && (age >= 25 && age <= 35) && !(lastname=Doe)
- Are in CNF (Conjunctive Normal Form)
Example:
Overview
use attribute_search_engine::{SearchEngine, SearchIndexHashMap, SearchIndexBTreeRange};
// Before we can create a new engine we need some indices.
let mut index_name = SearchIndexHashMap::<_, String>::new();
let mut index_age = SearchIndexBTreeRange::<_, u8>::new();
// We add two persons:
index_name.insert(0, "Alice".into());
index_age.insert(0, 27);
index_name.insert(1, "Bob".into());
index_name.insert(1, "Bobby".into()); // One row can have multiple entries
index_age.insert(1, 25);
// Now we create the engine and add our indices to it:
let mut engine = SearchEngine::<usize>::new();
engine.add_index("name", index_name);
engine.add_index("age", index_age);
// TODO Manual Queries, Queries out of strings, Prefix-Index
Dependencies
~2–3MB
~53K SLoC