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