[open-ils-commits] r19131 - trunk/Open-ILS/src/perlmods/OpenILS/Application (dbs)

svn at svn.open-ils.org svn at svn.open-ils.org
Thu Jan 6 13:47:25 EST 2011


Author: dbs
Date: 2011-01-06 13:47:21 -0500 (Thu, 06 Jan 2011)
New Revision: 19131

Modified:
   trunk/Open-ILS/src/perlmods/OpenILS/Application/SuperCat.pm
Log:
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.


Modified: trunk/Open-ILS/src/perlmods/OpenILS/Application/SuperCat.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/Application/SuperCat.pm	2011-01-05 23:23:39 UTC (rev 19130)
+++ trunk/Open-ILS/src/perlmods/OpenILS/Application/SuperCat.pm	2011-01-06 18:47:21 UTC (rev 19131)
@@ -1017,10 +1017,12 @@
 
 	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 @@
 	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 @@
 
 		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 @@
 	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) } },



More information about the open-ils-commits mailing list