From d95bac5bee524c3193db117a128463cba18584c4 Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Tue, 15 Oct 2019 16:10:56 -0400 Subject: [PATCH] stripdots and spacedots analyzers Signed-off-by: Bill Erickson --- .../src/perlmods/lib/OpenILS/Elastic/BibSearch.pm | 42 +++++++++++++++++++--- 1 file changed, 37 insertions(+), 5 deletions(-) diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Elastic/BibSearch.pm b/Open-ILS/src/perlmods/lib/OpenILS/Elastic/BibSearch.pm index e53cacb6ba..1d5340d343 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Elastic/BibSearch.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Elastic/BibSearch.pm @@ -39,6 +39,18 @@ my $BASE_INDEX_SETTINGS = { folding => { filter => ['lowercase', 'asciifolding'], tokenizer => 'standard' + }, + stripdots => { + # "R.E.M." => "REM" + char_filter => ['stripdots'], + filter => ['lowercase'], + tokenizer => 'standard' + }, + spacedots => { + # "R.E.M." => "R E M" + char_filter => ['spacedots'], + filter => ['lowercase'], + tokenizer => 'standard' } }, normalizer => { @@ -46,6 +58,16 @@ my $BASE_INDEX_SETTINGS = { type => 'custom', filter => ['lowercase'] } + }, + char_filter => { + stripdots => { + type => 'mapping', + mappings => ['. =>'] + }, + spacedots => { + type => 'mapping', + mappings => ['. => " "'] + } } } }; @@ -105,7 +127,9 @@ my $BASE_PROPERTIES = { normalizer => 'custom_lowercase', fields => { text => {type => 'text'}, - text_folded => {type => 'text', analyzer => 'folding'} + text_folded => {type => 'text', analyzer => 'folding'}, + text_spacedots => {type => 'text', analyzer => 'spacedots'}, + text_stripdots => {type => 'text', analyzer => 'stripdots'} } }, author => { @@ -114,7 +138,9 @@ my $BASE_PROPERTIES = { normalizer => 'custom_lowercase', fields => { text => {type => 'text'}, - text_folded => {type => 'text', analyzer => 'folding'} + text_folded => {type => 'text', analyzer => 'folding'}, + text_spacedots => {type => 'text', analyzer => 'spacedots'}, + text_stripdots => {type => 'text', analyzer => 'stripdots'} } }, subject => { @@ -123,7 +149,9 @@ my $BASE_PROPERTIES = { normalizer => 'custom_lowercase', fields => { text => {type => 'text'}, - text_folded => {type => 'text', analyzer => 'folding'} + text_folded => {type => 'text', analyzer => 'folding'}, + text_spacedots => {type => 'text', analyzer => 'spacedots'}, + text_stripdots => {type => 'text', analyzer => 'stripdots'} } }, series => { @@ -132,7 +160,9 @@ my $BASE_PROPERTIES = { normalizer => 'custom_lowercase', fields => { text => {type => 'text'}, - text_folded => {type => 'text', analyzer => 'folding'} + text_folded => {type => 'text', analyzer => 'folding'}, + text_spacedots => {type => 'text', analyzer => 'spacedots'}, + text_stripdots => {type => 'text', analyzer => 'stripdots'} } }, keyword => { @@ -143,7 +173,9 @@ my $BASE_PROPERTIES = { ignore_above => 256, fields => { text => {type => 'text'}, - text_folded => {type => 'text', analyzer => 'folding'} + text_folded => {type => 'text', analyzer => 'folding'}, + text_spacedots => {type => 'text', analyzer => 'spacedots'}, + text_stripdots => {type => 'text', analyzer => 'stripdots'} } }, identifier => { -- 2.11.0