about summary refs log tree commit homepage
path: root/lib/PublicInbox/Isearch.pm
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2023-08-19 08:30:51 +0000
committerEric Wong <e@80x24.org>2023-08-19 20:58:41 +0000
commite601fd7501a31da34af782aa43cf3281d1a0e453 (patch)
treeed8c2c740e3286801b0af2f6fe8a714c12dda4e5 /lib/PublicInbox/Isearch.pm
parent574bca21a001773d1bf4c5418a856a172b318d88 (diff)
downloadpublic-inbox-e601fd7501a31da34af782aa43cf3281d1a0e453.tar.gz
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")
Diffstat (limited to 'lib/PublicInbox/Isearch.pm')
-rw-r--r--lib/PublicInbox/Isearch.pm6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/PublicInbox/Isearch.pm b/lib/PublicInbox/Isearch.pm
index 5cbc36fd..5cac08ba 100644
--- a/lib/PublicInbox/Isearch.pm
+++ b/lib/PublicInbox/Isearch.pm
@@ -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);
 }