MCPcopy Create free account
hub / github.com/NodeDB-Lab/nodedb / index_and_search

Function index_and_search

nodedb/src/engine/sparse/inverted/tests.rs:25–52  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

23
24#[test]
25fn index_and_search() {
26 let (idx, _dir) = open_temp();
27 idx.index_document(
28 T,
29 "docs",
30 Surrogate::new(1),
31 "The quick brown fox jumps over the lazy dog",
32 )
33 .unwrap();
34 idx.index_document(
35 T,
36 "docs",
37 Surrogate::new(2),
38 "A fast brown dog runs across the field",
39 )
40 .unwrap();
41 idx.index_document(
42 T,
43 "docs",
44 Surrogate::new(3),
45 "Rust programming language for systems",
46 )
47 .unwrap();
48
49 let results = idx.search(T, "docs", "brown fox", 10, false, None).unwrap();
50 assert!(!results.is_empty());
51 assert_eq!(results[0].doc_id, Surrogate::new(1));
52}
53
54#[test]
55fn search_with_stemming() {

Callers

nothing calls this directly

Calls 3

open_tempFunction · 0.70
index_documentMethod · 0.45
searchMethod · 0.45

Tested by

no test coverage detected