[open-ils-commits] r15923 - trunk/Open-ILS/src/perlmods/OpenILS/Application/Storage/Driver/Pg (miker)

svn at svn.open-ils.org svn at svn.open-ils.org
Sun Mar 21 16:02:34 EDT 2010


Author: miker
Date: 2010-03-21 16:02:29 -0400 (Sun, 21 Mar 2010)
New Revision: 15923

Modified:
   trunk/Open-ILS/src/perlmods/OpenILS/Application/Storage/Driver/Pg/QueryParser.pm
Log:
remove OFFSET/LIMIT -- do that inside the stored proc for hit estimation; simplify phrase restriction logic

Modified: trunk/Open-ILS/src/perlmods/OpenILS/Application/Storage/Driver/Pg/QueryParser.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/Application/Storage/Driver/Pg/QueryParser.pm	2010-03-21 18:17:22 UTC (rev 15922)
+++ trunk/Open-ILS/src/perlmods/OpenILS/Application/Storage/Driver/Pg/QueryParser.pm	2010-03-21 20:02:29 UTC (rev 15923)
@@ -406,14 +406,6 @@
     my $key = 'm.source';
     $key = 'm.metarecord' if (grep {$_->name eq 'metarecord'} @{$self->modifiers});
 
-    my $sp_size = $self->QueryParser->superpage_size || 1000;
-    my $sp = $self->QueryParser->superpage || 1;
-
-    my $offset = '';
-    if ($sp > 1) {
-        $offset = 'OFFSET ' . ($sp - 1) * $sp_size;
-    }
-
     my ($before) = $self->find_filter('before');
     my ($after) = $self->find_filter('after');
     my ($during) = $self->find_filter('during');
@@ -466,9 +458,7 @@
         $bib_level
         AND $$flat_plan{where}
   GROUP BY 1
-  ORDER BY 4 $desc, 5 DESC
-  LIMIT $sp_size
-  $offset
+  ORDER BY 4 $desc, 5 DESC, 3 DESC
 SQL
 
 }
@@ -545,11 +535,9 @@
                 $from .= "\n\t\tLIMIT $core_limit\n\t) AS $talias ON (m.source = $talias.source)";
                 $from .= "\n\tJOIN config.metabib_field AS ${talias}_weight ON (${talias}_weight.id = $talias.field)\n";
 
-                $where .= $talias . ".id IS NOT NULL ";
-                my $phrases = $node->phrases;
-                if (@$phrases) {
-                    $where .= ' AND (' . join(' AND ', map {"$talias.value ~ \$_$$\$$_\$_$$\$"} @$phrases) . ')';;
-                }
+                $where .= '(' . $talias . ".id IS NOT NULL";
+                $where .= ' AND ' . join(' AND ', map {"$talias.value ~* \$_$$\$$_\$_$$\$"} @{$node->phrases}) if (@{$node->phrases});
+                $where .= ')';
 
                 push @rank_list, $node_rank;
 



More information about the open-ils-commits mailing list