probly-search ยท
A lightweight full-text search library that provides full control over the scoring calculations.
This start initially as a port of the Node library NDX.
Features
-
Three ways to do scoring
- BM25 ranking function to rank matching documents. The same ranking function that is used by default in Lucene >= 6.0.0.
- zero-to-one, a library unique scoring function that provides a normalized score that is bounded by 0 and 1. Perfect for matching titles/labels with queries.
- Ability to fully customize your own scoring function by implenting the
ScoreCalculator
trait.
-
Trie based dynamic Inverted Index.
-
Small memory footprint, optimized for mobile devices.
-
Multiple fields full-text indexing and searching.
-
Per-field score boosting.
-
Configurable tokenizer and term filter.
-
Free text queries with query expansion.
Documentation
Documentation is under development. For now read the source tests.
Example
Creating an index with a document that has 2 fields. Then indexing two documents and query for one using the BM25 scoring function
use HashSet;
use ;
// Create index with two fields
let mut idx: = create_index;
// Create docs from a custom Doc struct
let doc_1 = Doc ;
let doc_2 = Doc ;
// Add documents to index
add_document_to_index;
add_document_to_index;
// Search, expect 2 results
let mut result = query;
assert_eq!;
assert_eq!;
assert_eq!;
Go through source tests in for the BM25 implementation and zero-to-one implementation for more query examples.