probly-search · GitHub license Coverage Status ![Latest Version] PRs Welcome

A lightweight full-text search library that provides full control over the scoring calculations. Intended for creating small and short lifetime indices.

This library started as port of the Node library NDX.

Features

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 rust let mut idx: Index<usize> = create_index(2); let docs = vec![ Doc { id: 1, title: "a b c".to_string(), text: "hello world".to_string(), }, Doc { id: 2, title: "c d e".to_string(), text: "lorem ipsum".to_string(), }, ]; for doc in docs { add_document_to_index( &mut idx, &[title_extract, text_extract], tokenizer, filter, doc.id, doc, ); } let result = query( &mut idx, &vec![1., 1.], &score::default::bm25::default(), tokenizer, filter, None, &"a", ); assert_eq!(result.len(), 1); assert_eq!( approx_equal(result.get(0).unwrap().score, 0.6931471805599453, 8), true ); assert_eq!(result.get(0).unwrap().key, 1);

Go through source tests for more examples.

License

MIT