From a0a99a47766153cd43d4f1d7d37af78945465cf7 Mon Sep 17 00:00:00 2001 From: miker Date: Sun, 21 Mar 2010 18:17:22 +0000 Subject: [PATCH] add phrase cross-checking git-svn-id: svn://svn.open-ils.org/ILS/trunk@15922 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- .../perlmods/OpenILS/Application/Storage/Driver/Pg/QueryParser.pm | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Open-ILS/src/perlmods/OpenILS/Application/Storage/Driver/Pg/QueryParser.pm b/Open-ILS/src/perlmods/OpenILS/Application/Storage/Driver/Pg/QueryParser.pm index c8eb48bb43..8cfe876066 100644 --- a/Open-ILS/src/perlmods/OpenILS/Application/Storage/Driver/Pg/QueryParser.pm +++ b/Open-ILS/src/perlmods/OpenILS/Application/Storage/Driver/Pg/QueryParser.pm @@ -542,10 +542,14 @@ sub flatten { } my $core_limit = $self->QueryParser->core_limit || 25000; - $from .= "\n\t\tLIMIT " . $self->QueryParser->core_limit . "\n\t) AS " . $node->table_alias . ' ON (m.source = ' . $node->table_alias . ".source)"; + $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 .= $node->table_alias . ".id IS NOT NULL "; + $where .= $talias . ".id IS NOT NULL "; + my $phrases = $node->phrases; + if (@$phrases) { + $where .= ' AND (' . join(' AND ', map {"$talias.value ~ \$_$$\$$_\$_$$\$"} @$phrases) . ')';; + } push @rank_list, $node_rank; -- 2.11.0