From f8ea3a478bafc14415b82e15d55e656d72a1357b Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Fri, 13 Sep 2019 13:21:57 -0400 Subject: [PATCH] create some query_string shortcuts Signed-off-by: Bill Erickson --- .../src/perlmods/lib/OpenILS/Elastic/Bib/Search.pm | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Elastic/Bib/Search.pm b/Open-ILS/src/perlmods/lib/OpenILS/Elastic/Bib/Search.pm index c36e9e97b5..b110a8145b 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Elastic/Bib/Search.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Elastic/Bib/Search.pm @@ -141,9 +141,26 @@ my $BASE_PROPERTIES = { # Avoid full-text indexing on identifier fields. type => 'keyword', normalizer => 'custom_lowercase', - } + }, + + # Create some shortcut indexes for streamlining query_string searches. + ti => {type => 'text'}, + au => {type => 'text'}, + se => {type => 'text'}, + su => {type => 'text'}, + kw => {type => 'text'}, + id => {type => 'keyword'} }; +my %SHORT_GROUP_MAP = ( + title => 'ti', + author => 'au', + subject => 'su', + series => 'se', + keyword => 'kw', + identifier => 'id' +); + sub index_name { return $INDEX_NAME; } @@ -196,7 +213,7 @@ sub create_index { # Use the same fields and analysis as the 'grouped' field. $def = clone($mappings->{$search_group}); - $def->{copy_to} = $search_group if $search_group; + $def->{copy_to} = [$search_group, $SHORT_GROUP_MAP{$search_group}]; # Apply ranking boost to each analysis variation. my $flds = $def->{fields}; -- 2.11.0