From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS63949 45.79.64.0/19 X-Spam-Status: No, score=-3.0 required=3.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE, SPF_PASS,T_RP_MATCHES_RCVD shortcircuit=no autolearn=ham autolearn_force=no version=3.4.0 Received: from ms.lwn.net (ms.lwn.net [45.79.88.28]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id B64DE1F404 for ; Wed, 28 Mar 2018 21:00:32 +0000 (UTC) Received: from lwn.net (localhost [127.0.0.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ms.lwn.net (Postfix) with ESMTPSA id 2F9662F5; Wed, 28 Mar 2018 21:00:32 +0000 (UTC) Date: Wed, 28 Mar 2018 15:00:31 -0600 From: Jonathan Corbet To: Eric Wong Cc: meta@public-inbox.org Subject: Re: [PATCH] Allow specification of the number of search results to return Message-ID: <20180328150031.40df6080@lwn.net> In-Reply-To: <20180327104457.GA15422@80x24.org> References: <20180326163431.03fe26bc@lwn.net> <20180327104457.GA15422@80x24.org> Organization: LWN.net MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 8bit List-Id: On Tue, 27 Mar 2018 10:44:57 +0000 Eric Wong wrote: > Jonathan Corbet wrote: > > Add an "l=" parameter to the search query syntax to specify how many > > results should be returned. The default remains 200. > > --- > > 200 is a lot of results for one page, so allow it to be tweaked. I've not > > added anything to the query form to access this (don't need it) but could. > > There's the "feedmax" config variable, perhaps a config option > along those lines can be used with search results. That would solve my problem nicely, but takes the control out of the hands of the reader. Is this the approach you would rather see? > > --- a/lib/PublicInbox/SearchView.pm > > +++ b/lib/PublicInbox/SearchView.pm > > @@ -35,7 +35,7 @@ sub sres_top_html { > > my $code = 200; > > # double the limit for expanded views: > > my $opts = { > > - limit => $LIM, > > + limit => $q->{l}, > > Blindly trusting user input here could cause memory problems on > the server and should be clamped to a reasonable value. Yeah...I saw it sort of like the threat from doing a lot of simultaneous searches. It's better to limit it, though; I can certainly do that if you don't prefer the config-option approach. Thanks, jon