LP#1505286: limit number of facets retrieved
authorGalen Charlton <gmc@esilibrary.com>
Fri, 23 Oct 2015 16:29:38 +0000 (16:29 +0000)
committerBill Erickson <berickxx@gmail.com>
Thu, 25 Feb 2016 02:48:06 +0000 (21:48 -0500)
commit05ed3241809876704722bb593621da59039cbc00
treef48afb6f4f40f93c72f475b1716aef3f2fc93809
parent09924fdc2a9d1101846dc20c87a1fdacf029c0ac
LP#1505286: limit number of facets retrieved

This patch teaches search how to limit the number of facets retrieved
per defined facet field. Setting a limit is useful so that
open-ils.cstore backends don't end up needlessly consuming
memory when fetching facets for a large result set; if a broad
search retrieves over 10,000 author facets (say), even the most
persistant user is not going to actually look at all of them. Fetching
fewer facets can also slightly speed up generation of search
results.

The limit is controlled by a new global flag, search.max_facets_per_field,
whose label is "Search: maximum number of facet values to retrieve for
each facet field".  The default limit value is 1,000, but lower values
(e.g., 100) are perhaps even better for most catalogs.

To test:

[1] Upon applying the patch, set the value of the
    search.max_facets_per_field global flag to a small
    value.
[2] Perform some searches and verify that the number
    of facets retrieved doesn't exceed the limit; note
    that the limit is per facet *field*, not overall
    or per field class.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Signed-off-by: Ben Shum <ben@evergreener.net>
Open-ILS/src/perlmods/lib/OpenILS/Application/Search/Biblio.pm
Open-ILS/src/sql/Pg/300.schema.staged_search.sql
Open-ILS/src/sql/Pg/950.data.seed-values.sql
Open-ILS/src/sql/Pg/upgrade/XXXX.schema.limit_facets.sql [new file with mode: 0644]