╭─────────────╮ │scroll to top│ ╰─────────────╯ ╭ search_thread.zig ────────────────────────────────────────────╮ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ╰───────────────────────────────────────────────────────────────╯
╭────╮ ╭ clone ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ╮ │http│ ssh │ │ ╰────╯ ╰ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ╯
48 comptime hash_kind: hash.HashKind, 49 comptime kind: evt.EventKind, 50 haxy_moment: DB.HashMap(.read_only), 51 aa: std.mem.Allocator, 52 query_text: []const u8, 53 filter: ?DB.SortedSet(.read_only), 54 ) !srch.Query(DB) { 55 const cursor = try haxy_moment.getCursor(hash.hashInt(hash_kind, indexKey(kind))) orelse return .{ .terms = .empty }; 56 const index = try DB.SortedMap(.read_only).init(cursor); 57 var results = try srch.Query(DB).init(index, aa, query_text); 58 if (filter) |set| try results.require(aa, set); 59 return results; 60 } 61 62 // the text a thread is indexed under, none once it is removed: the title and 63 // labels first, so the tokenizer's caps can only drop the tail of a long 64 // description. 65 fn text(aa: std.mem.Allocator, record: anytype) ![]const u8 { 66 if (record.removed) return ""; 67 return std.mem.concat(aa, u8, &.{ record.event.title, " ", record.event.labels, " ", record.event.description }); 68 } 69