Merge branch 'new/bug11137' into 3.14.x

This commit is contained in:
Galen Charlton 2013-11-14 15:52:27 +00:00
commit c709bfec86
4 changed files with 19 additions and 11 deletions

View file

@ -111,7 +111,6 @@ sub add_bib1_field_map {
my ($self, $class, $field, $server, $attributes) = @_;
$self->add_search_field( $class => $field );
$self->add_search_field_alias( $class => $field => $field );
return $self->_add_field_mapping($self->bib1_field_map, $class, $field, $server, $attributes);
}
@ -542,14 +541,9 @@ sub initialize {
$self->add_bib1_field_map(
$class => $field => $server => $bib1_mapping );
}
$self->add_search_field_alias( $class => $field =>
$field_mappings->{$class}->{$field}->{'index'} );
foreach my $alias (
@{ $field_mappings->{$class}->{$field}->{'aliases'} } )
{
next
if ( $alias eq
$field_mappings->{$class}->{$field}->{'index'} );
$self->add_search_field_alias( $class => $field => $alias );
}
}

View file

@ -25,6 +25,7 @@ is($QParser->target_syntax('biblioserver', 'keyword|publisher:smith'), '@attr 1=
is($QParser->target_syntax('biblioserver', 'ti:"little engine that could"'), '@attr 1=4 @attr 4=1 "little engine that could"', 'phrase query');
is($QParser->target_syntax('biblioserver', 'keyword|titlekw:smith'), '@attr 1=4 @attr 9=20 @attr 2=102 @attr 4=6 "smith"', 'relevance-bumped query');
is($QParser->target_syntax('biblioserver', 'au:smith && johnson'), '@and @attr 1=1003 @attr 4=6 "smith" @attr 1=1003 @attr 4=6 "johnson"', 'query with boolean &&');
is($QParser->target_syntax('biblioserver', 'au:smith && ti:johnson'), '@and @attr 1=1003 @attr 4=6 "smith" @attr 1=4 @attr 4=6 "johnson"', 'query with boolean &&');
is($QParser->target_syntax('biblioserver', 'au:smith pubdate(-2008)'), '@and @attr 1=1003 @attr 4=6 "smith" @attr 4=4 @attr 1=pubdate @attr 2=2 "2008"', 'keyword search with pubdate limited to -2008');
is($QParser->target_syntax('biblioserver', 'au:smith pubdate(2008-)'), '@and @attr 1=1003 @attr 4=6 "smith" @attr 4=4 @attr 1=pubdate @attr 2=4 "2008"', 'keyword search with pubdate limited to 2008-');
is($QParser->target_syntax('biblioserver', 'au:smith pubdate(2008)'), '@and @attr 1=1003 @attr 4=6 "smith" @attr 4=4 @attr 1=pubdate "2008"', 'keyword search with pubdate limited to 2008');
@ -43,9 +44,7 @@ my $desired_config = {
'field_mappings' => {
'author' => {
'personal' => {
'aliases' => [
'personal'
],
'aliases' => [ ],
'bib1_mapping' => {
'biblioserver' => {
'1' => '1004'

View file

@ -12,7 +12,7 @@ use YAML;
use C4::Debug;
require C4::Context;
use Test::More tests => 196;
use Test::More tests => 200;
use Test::MockModule;
use MARC::Record;
use File::Spec;
@ -458,6 +458,19 @@ sub run_marc21_search_tests {
is($results_hashref->{biblioserver}->{hits}, 12,
'search using index whose name contains "ns" returns expected results (bug 10271)');
$UseQueryParser = 1;
( $error, $query, $simple_query, $query_cgi,
$query_desc, $limit, $limit_cgi, $limit_desc,
$stopwords_removed, $query_type ) = buildQuery([], [ 'book' ], [ 'kw' ], [], [], 0, 'en');
($error, $results_hashref, $facets_loop) = getRecords($query,$simple_query,[ ], [ 'biblioserver' ],20,0,undef,\%branches,\%itemtypes,$query_type,0);
is($results_hashref->{biblioserver}->{hits}, 101, "Search for 'book' with index set to 'kw' returns 101 hits");
( $error, $query, $simple_query, $query_cgi,
$query_desc, $limit, $limit_cgi, $limit_desc,
$stopwords_removed, $query_type ) = buildQuery([ 'and' ], [ 'book', 'another' ], [ 'kw', 'kw' ], [], [], 0, 'en');
($error, $results_hashref, $facets_loop) = getRecords($query,$simple_query,[ ], [ 'biblioserver' ],20,0,undef,\%branches,\%itemtypes,$query_type,0);
is($results_hashref->{biblioserver}->{hits}, 1, "Search for 'kw:book && kw:another' returns 1 hit");
$UseQueryParser = 0;
# FIXME: the availability limit does not actually work, so for the moment we
# are just checking that it behaves consistently
( $error, $query, $simple_query, $query_cgi,

View file

@ -44,7 +44,9 @@ make_path("$destination/var/run/zebradb");
$ENV{'INSTALL_BASE'} = $destination;
$ENV{'__INSTALL_BASE__'} = $destination;
my @files = ( "$source/etc/koha-conf.xml" );
my @files = ( "$source/etc/koha-conf.xml",
"$source/etc/searchengine/queryparser.yaml",
);
find(sub { push @files, $File::Find::name if ( -f $File::Find::name ); }, "$source/etc/zebradb");