From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-4.2 required=3.0 tests=ALL_TRUSTED,AWL,BAYES_00, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, T_SCC_BODY_TEXT_LINE shortcircuit=no autolearn=ham autolearn_force=no version=3.4.6 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id 46D6E1F888 for ; Mon, 13 Nov 2023 13:15:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=80x24.org; s=selector1; t=1699881356; bh=rx/a3ACpk74o2PnqW6O/ssTDt1ovIKSA4rToHz4pv6U=; h=From:To:Subject:Date:In-Reply-To:References:From; b=rLPk68WWTD/zf6esnMHp80t+NgRxRdth96BUbVO3ofPNl7TCJ64LEumPfHYKp1Vf9 UpG61Z2s0e+KNHStSr5DbEJW9OfwKot37sFCq7f5P/cClj1xlbyU5SAQsVR1kZqbpD AbyzIdt/7kFftQtgNDAfsdlov7MFSFKAOYOq6q8E= From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 16/18] cindex: do not guess integer maximum for Xapian Date: Mon, 13 Nov 2023 13:15:49 +0000 Message-Id: <20231113131551.843230-17-e@80x24.org> In-Reply-To: <20231113131551.843230-1-e@80x24.org> References: <20231113131551.843230-1-e@80x24.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: We can return an array to allow the caller to omit the internal `-m' arg entirely. We'll also allow any non-positive values to mean there's no limit; and we'll defer the "unlimited" case to the XapHelper implementation. This frees us of having to deal with mismatches between Perl and Xapian if Xapian was compiled with 64-bit docid support and we're stuck on a 32-bit Perl build. --- lib/PublicInbox/CodeSearchIdx.pm | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/PublicInbox/CodeSearchIdx.pm b/lib/PublicInbox/CodeSearchIdx.pm index 04c514fe..8e6b921d 100644 --- a/lib/PublicInbox/CodeSearchIdx.pm +++ b/lib/PublicInbox/CodeSearchIdx.pm @@ -501,11 +501,10 @@ sub shard_commit { # via wq_io_do send($op_p, "shard_done $self->{shard}", 0); } -sub assoc_max_init ($) { +sub assoc_max_args ($) { my ($self) = @_; my $max = $self->{-opt}->{'associate-max'} // $ASSOC_MAX; - $max = $ASSOC_MAX if !$max; - $max < 0 ? ((2 ** 31) - 1) : $max; + $max <= 0 ? () : ('-m', $max); } sub start_xhc () { @@ -538,7 +537,7 @@ sub dump_roots_start { run_await(\@sort, $CMD_ENV, $sort_opt, \&cmd_done, $associate); run_await(\@UNIQ_FOLD, $fold_env, $fold_opt, \&cmd_done, $associate); my @arg = ((map { ('-A', $_) } @ASSOC_PFX), '-c', - '-m', assoc_max_init($self), $root2id, $QRY_STR); + assoc_max_args($self), $root2id, $QRY_STR); for my $d ($self->shard_dirs) { pipe(my $err_r, my $err_w); $XHC->mkreq([$sort_w, $err_w], qw(dump_roots -d), $d, @arg); @@ -556,6 +555,8 @@ sub dump_ibx { # sends to xap_helper.h my $srch = $ibx->isrch or return warn <xh_args, (map { ('-A', $_) } @ASSOC_PFX), $ibx_id, $QRY_STR); pipe(my $r, my $w);