From: Eric Wong <e@80x24.org>
To: meta@public-inbox.org
Subject: [PATCH] searchview: clarify numeric summary at bottom
Date: Mon, 6 Feb 2017 02:33:46 +0000 [thread overview]
Message-ID: <20170206023346.27938-1-e@80x24.org> (raw)
Xapian can only give estimated results when a result limit is
given to it, so make clear it is an estimate to avoid showing
non-sensical ranges when no results are returned.
---
lib/PublicInbox/SearchView.pm | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/lib/PublicInbox/SearchView.pm b/lib/PublicInbox/SearchView.pm
index ccc53ab..5a95a05 100644
--- a/lib/PublicInbox/SearchView.pm
+++ b/lib/PublicInbox/SearchView.pm
@@ -145,15 +145,21 @@ sub search_nav_bot {
my $o = $q->{o};
my $end = $o + $nr;
my $beg = $o + 1;
- my $rv = "</pre><hr><pre>Results $beg-$end of $total";
+ my $rv = '</pre><hr><pre>';
+ if ($beg <= $end) {
+ $rv .= "Results $beg-$end of $total";
+ $rv .= ' (estimated)' if $end != $total;
+ } else {
+ $rv .= "No more results, only $total";
+ }
my $n = $o + $LIM;
if ($n < $total) {
my $qs = $q->qs_html(o => $n);
- $rv .= qq{, <a\nhref="?$qs"\nrel=next>next</a>}
+ $rv .= qq{ <a\nhref="?$qs"\nrel=next>next</a>}
}
if ($o > 0) {
- $rv .= $n < $total ? '/' : ', ';
+ $rv .= $n < $total ? '/' : ' ';
my $p = $o - $LIM;
my $qs = $q->qs_html(o => ($p > 0 ? $p : 0));
$rv .= qq{<a\nhref="?$qs"\nrel=prev>prev</a>};
--
EW
reply other threads:[~2017-02-06 2:33 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://public-inbox.org/README
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170206023346.27938-1-e@80x24.org \
--to=e@80x24.org \
--cc=meta@public-inbox.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/public-inbox.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).