From: Eric Wong Date: Wed, 5 Mar 2025 07:18:34 +0000 (+0000) Subject: search: avoid `git rev-parse' if using C++ xap_helper X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=4b037f2503286fd1920ca297c603fd4bbac1613e;p=thirdparty%2Fpublic-inbox.git search: avoid `git rev-parse' if using C++ xap_helper The C++ xap_helper can work with the Xapian query parser API to run run git_date_parse(), so there's no need to do janky string substitutions as we do for the Perl bindings. --- diff --git a/lib/PublicInbox/Search.pm b/lib/PublicInbox/Search.pm index 7fbee8594..535d6b83e 100644 --- a/lib/PublicInbox/Search.pm +++ b/lib/PublicInbox/Search.pm @@ -402,6 +402,7 @@ sub date_parse_finalize { # if this $argv isn't from a command execution sub query_argv_to_string { my (undef, $git, $argv) = @_; + return "@$argv" if $XHC && $XHC->{impl} eq 'PublicInbox::XapHelperCxx'; my $to_parse; my $tmp = join(' ', map {; if (s!\b(d|rt|dt):(\S+)\z!date_parse_prepare( @@ -420,6 +421,7 @@ sub query_argv_to_string { # this is for the WWW "q=" query parameter and "lei q --stdin" # it can't do d:"5 days ago", but it will do d:5.days.ago sub query_approxidate { + return if $XHC && $XHC->{impl} eq 'PublicInbox::XapHelperCxx'; my (undef, $git) = @_; # $_[2] = $query_string (modified in-place) my $DQ = qq<"\x{201c}\x{201d}>; # Xapian can use curly quotes $_[2] =~ tr/\x00/ /; # Xapian doesn't do NUL, we use it as a placeholder