Expand description
Attribute Search Engine is a generic search engine for rows consisting of attributes, that can be searched using different matchers.
§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§Which Index should I use?
| Query | SearchIndexHashMap | SearchIndexPrefixTree | SearchIndexBTreeRange |
|---|---|---|---|
| Exact | Yes ✔️ | Yes ✔️ | Yes ✔️ |
| Prefix | No ❌ | Yes ✔️ | No ❌ |
| InRange | No ❌ | No ❌ | Yes ✔️ |
| OutRange | No ❌ | No ❌ | Yes ✔️ |
| Minimum | No ❌ | No ❌ | Yes ✔️ |
| Maximum | No ❌ | No ❌ | Yes ✔️ |
| Or | na1 🔷 | na1 🔷 | na1 🔷 |
| And | na1 🔷 | na1 🔷 | na1 🔷 |
| Exclude | na1 🔷 | na1 🔷 | na1 🔷 |
Or, And & Exclude are only supported by SearchEngine and not the indices. ↩
Structs§
- Search
Engine - A SearchEngine is a wrapper around a collection of search indices that can process complex queries involving multiple indices.
- Search
IndexB Tree Range - SearchIndexBTreeRange is a index backed by a BTreeMap that can match Exact, InRange, OutRange, Minimum and Maximum queries.
- Search
Index Hash Map - SearchIndexHashMap is a index backed by a HashMap that can match Exact queries.
- Search
Index Prefix Tree - SearchIndexPrefixTree is a index backed by a prefix tree that can match Exact and Prefix queries. It can only store String attribute values.
Enums§
- Query
- Query is a recursive datatype that describes a query to a search index or engine.
- Search
Engine Error - Enum of all possible error types that the attribute search engine can throw by itself.
Traits§
- Search
Index - This trait describes the minimum features an Index must support to be usable as a SearchIndex, for example in a SearchEngine.
Type Aliases§
- Result
- Common Result type for the attribute search engine.