]> git.ipfire.org Git - thirdparty/public-inbox.git/commitdiff
isearch: avoid hex string for Xapian sortable_serialise
authorEric Wong <e@80x24.org>
Sat, 19 Aug 2023 08:30:51 +0000 (08:30 +0000)
committerEric Wong <e@80x24.org>
Sat, 19 Aug 2023 20:58:41 +0000 (20:58 +0000)
While a string representing a integer in hex is fine for DBI and
SQLite, Xapian's sortable_serialise requires a Perl integer value.
So just retrieve the last Xapian DB document ID in this rare
code path because we can't use 64-bit integer literals in some
32-bit Perl builds (e.g. OpenBSD on i386)

Fixes: be2a0a353d60 ("isearch: support 64-bit article numbers for SQLite query")
lib/PublicInbox/Isearch.pm

index 5cbc36fde8b326913955ed188f504203dbb3aedb..5cac08bae66e2bab7101242a7a544be85e4bb7ee 100644 (file)
@@ -47,11 +47,11 @@ SELECT MAX(docid) FROM xref3 WHERE ibx_id = ? AND xnum >= ? AND xnum <= ?
                $r[1] = $sth->fetchrow_array;
                if (defined($r[1]) && defined($r[0])) {
                        $opt{limit} = $r[1] - $r[0] + 1;
-               } else { # these are fed to SQLite
-                       $r[1] //= '0x7'.('f'x15); # string for some 32-bit Perl
+               } else {
+                       $r[1] //= $self->{es}->xdb->get_lastdocid;
                        $r[0] //= 0;
                }
-               $opt{uid_range} = \@r;
+               $opt{uid_range} = \@r; # these are fed to Xapian and SQLite
        }
        $self->{es}->mset($str, \%opt);
 }