From e64b2959bf426416b1354f0ffeaab0979db838bc Mon Sep 17 00:00:00 2001 From: miker Date: Thu, 10 Nov 2005 21:30:16 +0000 Subject: [PATCH] adjusting rank and "title" searching git-svn-id: svn://svn.open-ils.org/ILS/trunk@2000 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- .../perlmods/OpenILS/Application/Search/Authority.pm | 2 ++ .../Application/Storage/Publisher/authority.pm | 12 ++++++++---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/Open-ILS/src/perlmods/OpenILS/Application/Search/Authority.pm b/Open-ILS/src/perlmods/OpenILS/Application/Search/Authority.pm index d0ef219714..dec71fd07d 100644 --- a/Open-ILS/src/perlmods/OpenILS/Application/Search/Authority.pm +++ b/Open-ILS/src/perlmods/OpenILS/Application/Search/Authority.pm @@ -41,6 +41,7 @@ sub crossref_authority { } next if (lc($string) eq lc($term)); $hash{$string}++; + $hash{$string}++ if (lc($$x[0]) eq lc($term)); } my $from = [ sort { $hash{$b} <=> $hash{$a} || $a cmp $b } keys %hash ]; @@ -57,6 +58,7 @@ sub crossref_authority { } next if (lc($string) eq lc($term)); $hash{$string}++; + $hash{$string}++ if (lc($$x[0]) eq lc($term)); } my $also = [ sort { $hash{$b} <=> $hash{$a} || $a cmp $b } keys %hash ]; diff --git a/Open-ILS/src/perlmods/OpenILS/Application/Storage/Publisher/authority.pm b/Open-ILS/src/perlmods/OpenILS/Application/Storage/Publisher/authority.pm index 863805470c..07914a6667 100644 --- a/Open-ILS/src/perlmods/OpenILS/Application/Storage/Publisher/authority.pm +++ b/Open-ILS/src/perlmods/OpenILS/Application/Storage/Publisher/authority.pm @@ -37,7 +37,7 @@ sub find_authority_marc { my $fts = OpenILS::Application::Storage::FTS->compile($term, 'f.value', "f.$index_col"); my $fts_where = $fts->sql_where_clause; - my $fts_words = join '%', map { s/([\%\_'])/\\$1/go; }$fts->words; + my $fts_words = join '%', $fts->words; my $fts_words_where = "f.value LIKE '$fts_words\%'"; @@ -46,7 +46,7 @@ sub find_authority_marc { FROM $search_table f, $marc_table a WHERE $fts_where - AND $fts_words_where + -- AND $fts_words_where $tag_where $sf_where AND a.id = f.record @@ -97,9 +97,11 @@ sub find_see_from_controlled { my $term = shift; (my $class = $self->api_name) =~ s/^.+authority.([^\.]+)\.see.+$/$1/o; + my $sf = 'a'; + $sf = 't' if ($class eq 'title'); my @marc = $self->method_lookup('open-ils.storage.authority.search.marc') - ->run( term => $term, tag => '4%', subfield => 'a' ); + ->run( term => $term, tag => '4%', subfield => $sf ); for my $m ( @marc ) { my $doc = $parser->parse_string($m); my @nodes = $doc->documentElement->findnodes('//*[substring(@tag,1,1)="1"]/*'); @@ -124,9 +126,11 @@ sub find_see_also_from_controlled { my $term = shift; (my $class = $self->api_name) =~ s/^.+authority.([^\.]+)\.see.+$/$1/o; + my $sf = 'a'; + $sf = 't' if ($class eq 'title'); my @marc = $self->method_lookup('open-ils.storage.authority.search.marc') - ->run( term => $term, tag => '5%', subfield => 'a' ); + ->run( term => $term, tag => '5%', subfield => $sf ); for my $m ( @marc ) { my $doc = $parser->parse_string($m); my @nodes = $doc->documentElement->findnodes('//*[substring(@tag,1,1)="1"]/*'); -- 2.43.2