about summary refs log tree commit homepage
path: root/lib/PublicInbox/Search.pm
diff options
context:
space:
mode:
authorEric Wong <e@yhbt.net>2020-08-20 20:24:54 +0000
committerEric Wong <e@yhbt.net>2020-08-20 21:11:22 +0000
commit4c7baaa7dcacf1108c7db6e0ce484ab76c4a018a (patch)
treeb4450e989f7af9a574b3da98829e840c1b8318ca /lib/PublicInbox/Search.pm
parentb63ffbe2b634daedb05b1e27fc272e2708c2bf90 (diff)
downloadpublic-inbox-4c7baaa7dcacf1108c7db6e0ce484ab76c4a018a.tar.gz
We no longer read docdata.glass from anywhere in our code base.

Some adjustments were needed to t/search.t to deal with the
Xapian::WritableDatabase committing at different times, since
our ->query is avoided from PublicInbox::SearchIdx to avoid
needing a {over_ro} field.
Diffstat (limited to 'lib/PublicInbox/Search.pm')
-rw-r--r--lib/PublicInbox/Search.pm11
1 files changed, 7 insertions, 4 deletions
diff --git a/lib/PublicInbox/Search.pm b/lib/PublicInbox/Search.pm
index e6200bfb..1c648299 100644
--- a/lib/PublicInbox/Search.pm
+++ b/lib/PublicInbox/Search.pm
@@ -324,10 +324,13 @@ sub _enquire_once { # retry_reopen callback
         my $limit = $opts->{limit} || 50;
         my $mset = $enquire->get_mset($offset, $limit);
         return $mset if $opts->{mset};
-        my @msgs = map { PublicInbox::Smsg::from_mitem($_) } $mset->items;
-        return \@msgs unless wantarray;
-
-        ($mset->get_matches_estimated, \@msgs)
+        my $nshard = $self->{nshard} // 1;
+        my $i = 0;
+        my %order = map { mdocid($nshard, $_) => ++$i } $mset->items;
+        my @msgs = sort {
+                $order{$a->{num}} <=> $order{$b->{num}}
+        } @{$self->{over_ro}->get_all(keys %order)};
+        wantarray ? ($mset->get_matches_estimated, \@msgs) : \@msgs;
 }
 
 # read-write