diff options
author | Eric Wong <e@80x24.org> | 2023-11-28 14:56:21 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2023-11-29 02:13:22 +0000 |
commit | 67ecd56a0aaf977fa1a22aa6e2378c9317c72549 (patch) | |
tree | edb6e7d87ab1bc1b05bde1e5eb07d9b1ccab6a21 /lib/PublicInbox/Search.pm | |
parent | 10b23966ff8fa35a112f7fe2b9386dd4967d818c (diff) | |
download | public-inbox-67ecd56a0aaf977fa1a22aa6e2378c9317c72549.tar.gz |
This is a major step in solving the problem of having to manually associate hundreds/thousands of coderepos with hundreds/thousands of public-inboxes to power solver (and more).
Diffstat (limited to 'lib/PublicInbox/Search.pm')
-rw-r--r-- | lib/PublicInbox/Search.pm | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/PublicInbox/Search.pm b/lib/PublicInbox/Search.pm index 6145b027..8ef17d58 100644 --- a/lib/PublicInbox/Search.pm +++ b/lib/PublicInbox/Search.pm @@ -649,4 +649,21 @@ sub xh_args { # prep getopt args to feed to xap_helper.h socket map { ('-d', $_) } shard_dirs($_[0]); } +sub docids_by_postlist ($$) { + my ($self, $q) = @_; + my $cur = $self->xdb->postlist_begin($q); + my $end = $self->{xdb}->postlist_end($q); + my @ids; + for (; $cur != $end; $cur++) { push(@ids, $cur->get_docid) }; + @ids; +} + +sub get_doc ($$) { + my ($self, $docid) = @_; + eval { $self->{xdb}->get_document($docid) } // do { + die $@ if $@ && ref($@) !~ /\bDocNotFoundError\b/; + undef; + } +} + 1; |