From: dbs Date: Thu, 6 Jan 2011 18:47:21 +0000 (+0000) Subject: Teach supercat browse / startwith to return a distinct set of records X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=777e0f9de88cc2399f0457a96fde0864c3f28493;p=evergreen%2Ftadl.git Teach supercat browse / startwith to return a distinct set of records The addition of the .refs variants exposed feeds that had multiple copies of the same bib in the same results (e.g. if 1xx was "Scott, Daniel" and 4xx in the same record was "Scott, Dan" it would be returned twice). Filtering it in this call prevents the callers from requesting 10 records and only getting 7 back (or whatever). If there's an actual use case for getting the same record twice, we can revisit this. Note that the authority context menu currently still shows duplicate records, because the record is displayed in full for each 4xx / 5xx entry, that will be fixed in a subsequent patch. Also, prevent supercat browse from issuing two separate requests for page = 0; the second would always stomp on the results of the first, so I just made the first request go away in that case. git-svn-id: svn://svn.open-ils.org/ILS/trunk@19131 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- diff --git a/Open-ILS/src/perlmods/OpenILS/Application/SuperCat.pm b/Open-ILS/src/perlmods/OpenILS/Application/SuperCat.pm index 4d64dae483..31e92921bc 100644 --- a/Open-ILS/src/perlmods/OpenILS/Application/SuperCat.pm +++ b/Open-ILS/src/perlmods/OpenILS/Application/SuperCat.pm @@ -1017,10 +1017,12 @@ sub authority_tag_sf_browse { my @list = (); - if ($page <= 0) { + if ($page < 0) { my $before = $_storage->request( "open-ils.cstore.json_query.atomic", - { select => { afr => [qw/record value/] }, + { select => { afr => [ + { transform => "distinct", column => "record" }, + "value" ]}, from => { 'are', 'afr' }, where => { '+afr' => { tag => $tag, subfield => $subfield, value => { '<' => lc($value) } }, @@ -1037,7 +1039,9 @@ sub authority_tag_sf_browse { if ($page >= 0) { my $after = $_storage->request( "open-ils.cstore.json_query.atomic", - { select => { afr => [qw/record value/] }, + { select => { afr => [ + { transform => "distinct", column => "record" }, + "value" ]}, from => { 'are', 'afr' }, where => { '+afr' => { tag => $tag, subfield => $subfield, value => { '>=' => lc($value) } }, @@ -1510,7 +1514,9 @@ sub authority_tag_sf_startwith { my $before = $_storage->request( "open-ils.cstore.json_query.atomic", - { select => { afr => [qw/record value/] }, + { select => { afr => [ + { transform => "distinct", column => "record" }, + "value" ]}, from => { 'afr', 'are' }, where => { '+afr' => { tag => $tag, subfield => $subfield, value => { '<' => lc($value) } }, @@ -1527,7 +1533,9 @@ sub authority_tag_sf_startwith { if ($page >= 0) { my $after = $_storage->request( "open-ils.cstore.json_query.atomic", - { select => { afr => [qw/record value/] }, + { select => { afr => [ + { transform => "distinct", column => "record" }, + "value" ]}, from => { 'afr', 'are' }, where => { '+afr' => { tag => $tag, subfield => $subfield, value => { '>=' => lc($value) } },