-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathBigSearch.mo
39 lines (31 loc) · 1 KB
/
BigSearch.mo
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import Search "../src/Search";
import Debug "mo:base/Debug";
import Result "mo:base/Result";
actor {
public type FileId = Search.FileId;
flexible var bigSearch = Search.BigSearch();
// do a keyword search, limited to at most maxResults
public query func search(q : ?Text, maxResults : Nat) : async [Search.SearchResult] {
bigSearch.search(q, maxResults)
};
/// create a new text sequence
public func create(n : ?Text, m : ?Text, c : Text) : async FileId {
bigSearch.create(n, m, c)
};
/// delete a text sequence
public func delete(id : FileId) : async Bool {
bigSearch.delete(id)
};
/// append to an existing text sequence
public func addText(id : FileId, t : Text) : async Bool {
bigSearch.addText(id, t)
};
/// read a text sequence
public func readText(id : FileId) : async ?Text {
bigSearch.readText(id)
};
/// read a text sequence slice
public func readSlice(id : FileId, pos : Nat, size : Nat) : async ?Text {
bigSearch.readSlice(id, pos, size)
};
}