From 6dba37596eb4cd7943bb6c4f3605a75befeadbd7 Mon Sep 17 00:00:00 2001 From: Silvia Witzig Date: Thu, 14 Feb 2019 10:41:13 +0100 Subject: [PATCH 01/52] Fachbereichsfacette, config --- local/classic/local/config/vufind/config_base.ini | 1 + local/config/vufind/config_base.ini | 1 + local/config/vufind/facets.ini | 7 +++++-- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/local/classic/local/config/vufind/config_base.ini b/local/classic/local/config/vufind/config_base.ini index 6941d8d785e..5637315c04c 100644 --- a/local/classic/local/config/vufind/config_base.ini +++ b/local/classic/local/config/vufind/config_base.ini @@ -294,6 +294,7 @@ textDomains[] = formats textDomains[] = languagecodes textDomains[] = relators textDomains[] = drsys +textDomains[] = ddc ;todo: we need a definition for this multi domain ;but: the naming convention should be en.ini etc and each network a specialized domain ;this interferes currently with the emchanism to fetch the translations diff --git a/local/config/vufind/config_base.ini b/local/config/vufind/config_base.ini index 3a5bf4b2bce..676143e55a9 100644 --- a/local/config/vufind/config_base.ini +++ b/local/config/vufind/config_base.ini @@ -298,6 +298,7 @@ textDomains[] = formats textDomains[] = languagecodes textDomains[] = CreatorRoles textDomains[] = drsys +textDomains[] = ddc ;todo: we need a definition for this multi domain ;but: the naming convention should be en.ini etc and each network a specialized domain ;this interferes currently with the emchanism to fetch the translations diff --git a/local/config/vufind/facets.ini b/local/config/vufind/facets.ini index 022a04e55bc..3fef61a6424 100644 --- a/local/config/vufind/facets.ini +++ b/local/config/vufind/facets.ini @@ -8,6 +8,7 @@ override_full_sections = "Results,ResultsTop,Advanced,SpecialFacets,HomePage" [Results] e_institution_str_mv = onlineAvailable institution = Institution +classif_ddc_facet = DDC navSub_orange = "Suggested Topics" navAuthor_orange = Author format_hierarchy_str_mv = Format @@ -38,6 +39,7 @@ dateRange[] = publishDate ; (see https://wiki.apache.org/solr/HierarchicalFaceting but note that we always ; use a trailing slash to avoid ambiquities) hierarchical[] = format_hierarchy_str_mv +hierarchical[] = classif_ddc_facet ; Sort options for hierarchical facets: ; How hierarchical facets are sorted. Default is result count, but alternative ways ; can be specified: @@ -77,8 +79,8 @@ showMore[mylibrary] = 1000 ;facet_limit_by_field[institution] = 5 ;facet_limit_by_field[mylibrary] = 5 -exclude = e_institution_str_mv,navSub_orange,navAuthor_orange,format_hierarchy_str_mv,language,institution,navSubform -orFacets = e_institution_str_mv,navAuthor_orange,format_hierarchy_str_mv,language,institution,navSubform +exclude = e_institution_str_mv,navSub_orange,navAuthor_orange,format_hierarchy_str_mv,language,institution,navSubform,classif_ddc_facet +orFacets = e_institution_str_mv,navAuthor_orange,format_hierarchy_str_mv,language,institution,navSubform,classif_ddc_facet showMoreInLightbox[*] = true @@ -103,6 +105,7 @@ translated_facets[] = union:union translated_facets[] = format_str_mv:formats translated_facets[] = mylibrary:institution translated_facets[] = e_institution_str_mv:institution +translated_facets[] = classif_ddc_facet:ddc [HomePage] union = "Union" From f28749231aab2eee7920987345f5e79514c3007b Mon Sep 17 00:00:00 2001 From: Silvia Witzig Date: Thu, 21 Mar 2019 16:29:36 +0100 Subject: [PATCH 02/52] Sortierung Fachbereichsfacette --- local/config/vufind/facets_baselbern.ini | 1 + 1 file changed, 1 insertion(+) diff --git a/local/config/vufind/facets_baselbern.ini b/local/config/vufind/facets_baselbern.ini index 3fef61a6424..ae3ceb3ee49 100644 --- a/local/config/vufind/facets_baselbern.ini +++ b/local/config/vufind/facets_baselbern.ini @@ -48,6 +48,7 @@ hierarchical[] = classif_ddc_facet ; second level the library branch) ; all = Sort all levels alphabetically hierarchicalFacetSortOptions[format_hierarchy_str_mv] = all +hierarchicalFacetSortOptions[classif_ddc_facet] = all ; How hierarchical facet values are displayed in the records: ; single = Display only the deepest level (default) ; full = Display full hierarchy for each entry From a35d71879a10bd3e40071bf8427de4a055d32cd9 Mon Sep 17 00:00:00 2001 From: Silvia Witzig Date: Thu, 21 Mar 2019 16:29:56 +0100 Subject: [PATCH 03/52] =?UTF-8?q?feature=20config=20f=C3=BCr=20Test=20Fach?= =?UTF-8?q?bereichsfacette?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- local/classic/feature/config/vufind/config.ini | 4 ++-- local/classic/feature/config/vufind/facets.ini | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/local/classic/feature/config/vufind/config.ini b/local/classic/feature/config/vufind/config.ini index 17465c43205..bd6c5a0befb 100644 --- a/local/classic/feature/config/vufind/config.ini +++ b/local/classic/feature/config/vufind/config.ini @@ -5,9 +5,9 @@ path = local/config/vufind/config_base.ini [Index] engine = Solr -;url = http://search.swissbib.ch/solr +url = http://sbbc1.swissbib.ch/solr maxBooleanClauses = 1024 -;default_core = sb-biblio +default_core = bb timeout = 30 [Database] diff --git a/local/classic/feature/config/vufind/facets.ini b/local/classic/feature/config/vufind/facets.ini index e766a20ad97..35a55469a97 100644 --- a/local/classic/feature/config/vufind/facets.ini +++ b/local/classic/feature/config/vufind/facets.ini @@ -1,2 +1,2 @@ [Parent_Config] -path = local/config/vufind/facets_classic.ini +path = local/config/vufind/facets_baselbern.ini From 409a549ac663bbfeb051f8b7db94e086c88c833c Mon Sep 17 00:00:00 2001 From: Silvia Witzig Date: Mon, 25 Mar 2019 16:00:08 +0100 Subject: [PATCH 04/52] Titel Fachbereichsfacette angepasst --- local/languages/de.ini | 1 + local/languages/en.ini | 1 + local/languages/fr.ini | 1 + local/languages/it.ini | 1 + 4 files changed, 4 insertions(+) diff --git a/local/languages/de.ini b/local/languages/de.ini index b62c250a9fe..0fd73c9ee64 100644 --- a/local/languages/de.ini +++ b/local/languages/de.ini @@ -319,6 +319,7 @@ renew_select = "Verlängern" sort_author = "Verfasser" sort_title = "Titel" sort_relevance = "Relevanz" +subjectArea = "Fachbereich" summon_database_recommendations = "Weitere Ressourcen" external_access_info = "Sie befinden sich ausserhalb des Rechnernetzes der Universität Basel / Universität Bern. Der Zugriff auf die Volltexte von lizenzierten Produkten ist daher eingeschränkt. Als Angehörige der Universität Basel oder Bern aktivieren Sie bitte VPN" diff --git a/local/languages/en.ini b/local/languages/en.ini index 9d10c8d6299..99c2b8060d0 100644 --- a/local/languages/en.ini +++ b/local/languages/en.ini @@ -318,6 +318,7 @@ renew_select = "Renew" sort_author = "Author" sort_title = "Title" sort_relevance = "Relevance" +subjectArea = "Fachbereich" summon_database_recommendations = "Additional resources" external_access_info = "Your IP address does not belong to the local network of the University Basel or University Bern. Access to full text may be restricted. Members of the University of Berne and Basel should connect by using their VPN client" diff --git a/local/languages/fr.ini b/local/languages/fr.ini index 7213ae14a9b..efe0edbaa7e 100644 --- a/local/languages/fr.ini +++ b/local/languages/fr.ini @@ -318,6 +318,7 @@ renew_select = "Prolonger" sort_author = "Auteur" sort_title = "Titre" sort_relevance = "Pertinence" +subjectArea = "Fachbereich" summon_database_recommendations = "Ressources supplémentaires" external_access_info = "Votre adresse IP est localisée au dehors des reseaux universitaires de Bâle ou de Berne. L'accès aux textes intégraux est limité. Les universitaires de Bâle ou de Berne doivent se connecter par le client VPN" diff --git a/local/languages/it.ini b/local/languages/it.ini index ce186e5840d..8858c971c2c 100644 --- a/local/languages/it.ini +++ b/local/languages/it.ini @@ -324,6 +324,7 @@ renew_select = "Prolungare" sort_author = "Autore" sort_title = "Titolo" sort_relevance = "Rilevanza" +subjectArea = "Fachbereich" summon_database_recommendations = "Altre risorse" external_access_info = "Your IP address does not belong to the local network of the University Basel or University Bern. Access to full text may be restricted. Members of the University of Berne and Basel should connect by using their VPN client" From 53f122ae5311d7d67b7fbd81e8d128bd11ac2a17 Mon Sep 17 00:00:00 2001 From: Silvia Witzig Date: Mon, 25 Mar 2019 16:01:23 +0100 Subject: [PATCH 05/52] Titel Fachbereichsfacette --- local/config/vufind/facets_baselbern.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/local/config/vufind/facets_baselbern.ini b/local/config/vufind/facets_baselbern.ini index ae3ceb3ee49..aa70b3962d6 100644 --- a/local/config/vufind/facets_baselbern.ini +++ b/local/config/vufind/facets_baselbern.ini @@ -8,7 +8,7 @@ override_full_sections = "Results,ResultsTop,Advanced,SpecialFacets,HomePage" [Results] e_institution_str_mv = onlineAvailable institution = Institution -classif_ddc_facet = DDC +classif_ddc_facet = subjectArea navSub_orange = "Suggested Topics" navAuthor_orange = Author format_hierarchy_str_mv = Format From f8bdb546a0802e34218f938fc8270d32a8d815f7 Mon Sep 17 00:00:00 2001 From: Silvia Witzig Date: Fri, 29 Mar 2019 12:36:32 +0100 Subject: [PATCH 06/52] =?UTF-8?q?config=20devbabe=20auf=20prod=20Index,=20?= =?UTF-8?q?config=20feature=20zur=C3=BCck=20auf=20green?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- local/baselbern/devbabe/config/vufind/config.ini | 7 ++----- local/classic/feature/config/vufind/config.ini | 4 ++-- local/classic/feature/config/vufind/facets.ini | 2 +- 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/local/baselbern/devbabe/config/vufind/config.ini b/local/baselbern/devbabe/config/vufind/config.ini index 2b13d978c47..31cd117f297 100644 --- a/local/baselbern/devbabe/config/vufind/config.ini +++ b/local/baselbern/devbabe/config/vufind/config.ini @@ -24,12 +24,9 @@ checked_out_page_size = 50 [Index] engine = Solr -;for national licenses -;url = http://sb-up2.swissbib.unibas.ch/solr -url = http://sb-us3.swissbib.unibas.ch:8080/solr +url = http://sbbc1.swissbib.ch/solr maxBooleanClauses = 1024 -;default_core = bb -default_core = bbGND +default_core = bb timeout = 30 ;default_dismax_handler = edismax diff --git a/local/classic/feature/config/vufind/config.ini b/local/classic/feature/config/vufind/config.ini index bd6c5a0befb..17465c43205 100644 --- a/local/classic/feature/config/vufind/config.ini +++ b/local/classic/feature/config/vufind/config.ini @@ -5,9 +5,9 @@ path = local/config/vufind/config_base.ini [Index] engine = Solr -url = http://sbbc1.swissbib.ch/solr +;url = http://search.swissbib.ch/solr maxBooleanClauses = 1024 -default_core = bb +;default_core = sb-biblio timeout = 30 [Database] diff --git a/local/classic/feature/config/vufind/facets.ini b/local/classic/feature/config/vufind/facets.ini index 35a55469a97..e766a20ad97 100644 --- a/local/classic/feature/config/vufind/facets.ini +++ b/local/classic/feature/config/vufind/facets.ini @@ -1,2 +1,2 @@ [Parent_Config] -path = local/config/vufind/facets_baselbern.ini +path = local/config/vufind/facets_classic.ini From 21ce807eb07c374146c446fb516d4c22114eb77e Mon Sep 17 00:00:00 2001 From: Lionel Walter Date: Wed, 26 Jun 2019 20:00:45 +0200 Subject: [PATCH 07/52] some tests --- local/classic/test/config/vufind/config.ini | 4 ++-- local/config/vufind/searchspecs.yaml | 20 +------------------ .../VuFindSearch/Backend/Solr/Connector.php | 4 ++-- .../search/spellingSuggestions.phtml | 17 ++++++++++++++++ 4 files changed, 22 insertions(+), 23 deletions(-) diff --git a/local/classic/test/config/vufind/config.ini b/local/classic/test/config/vufind/config.ini index cde9f99ae3a..29a8c933ef5 100644 --- a/local/classic/test/config/vufind/config.ini +++ b/local/classic/test/config/vufind/config.ini @@ -5,8 +5,8 @@ path = local/config/vufind/config_base.ini [Index] engine = Solr -url = http://sb-up1.swissbib.unibas.ch/solr -;url = http://localhost:8984/solr +;url = http://sb-up1.swissbib.unibas.ch/solr +url = http://localhost:8984/solr maxBooleanClauses = 1024 timeout = 30 ;default_core = suggestions diff --git a/local/config/vufind/searchspecs.yaml b/local/config/vufind/searchspecs.yaml index 93733e90d83..99fd9114378 100644 --- a/local/config/vufind/searchspecs.yaml +++ b/local/config/vufind/searchspecs.yaml @@ -20,25 +20,7 @@ AllFields: - author_additional_gnd_txt_mv^100 # variants from GND - title_additional_gnd_txt_mv^100 - publplace_additional_gnd_txt_mv^100 - - series^200 - - topic^500 # all verbal topics, i.e. 6xx - - related_gnd_txt_mv^500 # GND related terms 5xx - - addfields_txt_mv^50 # additional fields - - publplace_txt_mv^25 # publication country and place, i.e. 752ad - - publplace_dsv11_txt_mv^25 - - fulltext # imported fulltext, i.e. TOC/Abstracts - - callnumber_txt_mv^50 # callnumbers (works only when quoted) with low boost - - ctrlnum^1000 - - publishDate - - isbn - - cancisbn_isn_mv - - variant_isbn_isn_mv - - issn - - incoissn_isn_mv - - ismn_isn_mv - - doi_isn_mv - - urn_isn_mv - - localcode # local codes (field 909) : should be removed after next full reindex. It will be replaced by localcode_txt_mv + # local codes (field 909) : should be removed after next full reindex. It will be replaced by localcode_txt_mv - localcode_txt_mv # local codes splitted at spaces - id_txt DismaxParams: diff --git a/module/VuFindSearch/src/VuFindSearch/Backend/Solr/Connector.php b/module/VuFindSearch/src/VuFindSearch/Backend/Solr/Connector.php index 6f567a2af7d..a8405b81280 100644 --- a/module/VuFindSearch/src/VuFindSearch/Backend/Solr/Connector.php +++ b/module/VuFindSearch/src/VuFindSearch/Backend/Solr/Connector.php @@ -450,12 +450,12 @@ protected function trySolrUrls($method, $urlSuffix, $callback = null) protected function send(HttpClient $client) { //useful to display links to solr queries directly on screen - /* + echo 'solr link'; - */ + $this->debug( sprintf('=> %s %s', $client->getMethod(), $client->getUri()) diff --git a/themes/sbvfrd/templates/search/spellingSuggestions.phtml b/themes/sbvfrd/templates/search/spellingSuggestions.phtml index e3e5cb23eab..e19b7560440 100644 --- a/themes/sbvfrd/templates/search/spellingSuggestions.phtml +++ b/themes/sbvfrd/templates/search/spellingSuggestions.phtml @@ -3,6 +3,23 @@ $suggestions = $this->results->getSpellingSuggestions(); $query = $this->results->getUrlQuery(); ?> +

added

+results; +$label = $results->getResultTotal() > 0 + ? '' . $this->transEsc('spell_suggest') . ':' + : $this->transEsc('nohit_spelling') . ':'; +$suggestions = $this->search()->renderSpellingSuggestions($label, $results, $this); +?> + + + + + + + + +
From 09984927cf49e50059b69f0b24bc2fa93b842103 Mon Sep 17 00:00:00 2001 From: edelm Date: Thu, 27 Jun 2019 11:05:27 +0200 Subject: [PATCH 08/52] restrict aleph/ils requests depending on 949 and 898a --- .../Swissbib/Controller/SearchController.php | 55 +++++++++++++++++-- .../src/Swissbib/RecordDriver/SolrMarc.php | 20 +++++++ 2 files changed, 70 insertions(+), 5 deletions(-) diff --git a/module/Swissbib/src/Swissbib/Controller/SearchController.php b/module/Swissbib/src/Swissbib/Controller/SearchController.php index 14fc993a44d..58b64cf72ef 100644 --- a/module/Swissbib/src/Swissbib/Controller/SearchController.php +++ b/module/Swissbib/src/Swissbib/Controller/SearchController.php @@ -30,6 +30,7 @@ */ namespace Swissbib\Controller; +use Swissbib\RecordDriver\SolrMarc; use Swissbib\VuFind\Search\Results\PluginManager as SwissbibSearchResultsPluginManager; use VuFind\Controller\SearchController as VuFindSearchController; @@ -127,6 +128,54 @@ public function availabilityByLibraryNetworkAction() $record = $this->getRecord($idRecord); $availabilities = []; + if (empty($record->getField('949',['B','F','b','c','j']))) { + $field898a = $record->getField('898', ['a']); + $field898a = $field898a[0]; + if (substr_compare($field898a, '53', -strlen('53')) == 0) { + // all institutions of the record get the 'available' flag: + $institutions = $record->getInstitutions(true); + foreach ($institutions as $institution) { + $availabilities = array_merge( + $availabilities, + [$institution['institution'] => '0'] + ); + } + } else { + $doAlephRequest = + substr_compare($field898a, 'CR02', 0, strlen('CR02')) === 0 || + substr_compare($field898a, 'CR0300', 0, strlen('CR0300')) === 0 || + substr_compare($field898a, 'CR0301', 0, strlen('CR0301')) === 0 || + substr_compare($field898a, 'CR0302', 0, strlen('CR0302')) === 0 || + substr_compare($field898a, 'CR0303', 0, strlen('CR0303')) === 0 || + substr_compare($field898a, 'CR0304', 0, strlen('CR0304')) === 0 || + substr_compare($field898a, 'CR0305', 0, strlen('CR0305')) === 0 || + substr_compare($field898a, 'CR0306', 0, strlen('CR0306')) === 0 || + substr_compare($field898a, 'CR0307', 0, strlen('CR0307')) === 0 || + substr_compare($field898a, 'CR0308', 0, strlen('CR0308')) === 0; + if ($doAlephRequest) { + $availabilities = $this->doAlephAvailabilityRequest($record); + } + } + } else { + $availabilities = $this->doAlephAvailabilityRequest($record); + } + + $response = $this->getResponse(); + $response->setStatusCode(200); + $response->setContent(json_encode($availabilities)); + return $response; + } + + /** + * Do Aleph Availability Request + * + * @param $record SolrMarc the solrMarc record + * + * @return array + */ + private function doAlephAvailabilityRequest(SolrMarc $record) + { + $availabilities = []; $alwaysAvailableGroups = [ 'RETROS', 'BORIS', @@ -166,11 +215,7 @@ public function availabilityByLibraryNetworkAction() ); } } - - $response = $this->getResponse(); - $response->setStatusCode(200); - $response->setContent(json_encode($availabilities)); - return $response; + return $availabilities; } /** diff --git a/module/Swissbib/src/Swissbib/RecordDriver/SolrMarc.php b/module/Swissbib/src/Swissbib/RecordDriver/SolrMarc.php index 093ff28f3a9..7bfa2822774 100644 --- a/module/Swissbib/src/Swissbib/RecordDriver/SolrMarc.php +++ b/module/Swissbib/src/Swissbib/RecordDriver/SolrMarc.php @@ -2811,6 +2811,26 @@ public function getHoldingsStructure() return $this->getHoldingsHelper()->getHoldingsStructure(); } + /** + * Return an array of all values extracted from the specified field/subfield + * combination. If multiple subfields are specified and $concat is true, they + * will be concatenated together in the order listed -- each entry in the array + * will correspond with a single MARC field. If $concat is false, the return + * array will contain separate entries for separate subfields. + * + * @param string $field The MARC field number to read + * @param array $subfields The MARC subfield codes to read + * @param bool $concat Should we concatenate subfields? + * @param string $separator Separator string (used only when $concat === true) + * + * @return array + */ + public function getField($field, $subfields = null, $concat = true, + $separator = ' ') + { + return $this->getFieldArray($field, $subfields, $concat, $separator); + } + /** * Returns institutions which we won't show by its name * From a5cdb81abb28d5ec1903eea74de8c2433e514450 Mon Sep 17 00:00:00 2001 From: Lionel Walter Date: Mon, 1 Jul 2019 09:58:50 +0200 Subject: [PATCH 09/52] display viaf links correctly for viaf uri starting with http or https --- local/config/vufind/searches.ini | 2 +- local/jus/jusdev/config/vufind/searches.ini | 2 +- local/jus/justest/config/vufind/searches.ini | 2 +- local/jus/local/config/vufind/searches.ini | 2 +- local/jus/productive/config/vufind/searches.ini | 2 +- local/linked/jusdev/config/vufind/searches.ini | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/local/config/vufind/searches.ini b/local/config/vufind/searches.ini index 3dce7550142..3f77edf8163 100644 --- a/local/config/vufind/searches.ini +++ b/local/config/vufind/searches.ini @@ -79,7 +79,7 @@ record.references.gnd.pattern = "/^http:\\/\\/d-nb.info\\/gnd\\/.*$/" record.references.dbpedia.label = DBPedia record.references.dbpedia.pattern = "/^https:\\/\\/dbpedia.org\\/resource\\/.*$/" record.references.viaf.label = VIAF -record.references.viaf.pattern = "/^https:\\/\\/viaf.org\\/viaf\\/.*$/" +record.references.viaf.pattern = "/^https{0,1}:\\/\\/viaf.org\\/viaf\\/.*$/" [MoreLikeThis] useMoreLikeThisHandler = true diff --git a/local/jus/jusdev/config/vufind/searches.ini b/local/jus/jusdev/config/vufind/searches.ini index 01345dc5267..b87079800a0 100644 --- a/local/jus/jusdev/config/vufind/searches.ini +++ b/local/jus/jusdev/config/vufind/searches.ini @@ -79,7 +79,7 @@ record.references.gnd.pattern = "/^http:\\/\\/d-nb.info\\/gnd\\/.*$/" record.references.dbpedia.label = DBPedia record.references.dbpedia.pattern = "/^http:\\/\\/dbpedia.org\\/resource\\/.*$/" record.references.viaf.label = VIAF -record.references.viaf.pattern = "/^http:\\/\\/viaf.org\\/viaf\\/.*$/" +record.references.viaf.pattern = "/^https{0,1}:\\/\\/viaf.org\\/viaf\\/.*$/" [MoreLikeThis] useMoreLikeThisHandler = true diff --git a/local/jus/justest/config/vufind/searches.ini b/local/jus/justest/config/vufind/searches.ini index 01345dc5267..b87079800a0 100644 --- a/local/jus/justest/config/vufind/searches.ini +++ b/local/jus/justest/config/vufind/searches.ini @@ -79,7 +79,7 @@ record.references.gnd.pattern = "/^http:\\/\\/d-nb.info\\/gnd\\/.*$/" record.references.dbpedia.label = DBPedia record.references.dbpedia.pattern = "/^http:\\/\\/dbpedia.org\\/resource\\/.*$/" record.references.viaf.label = VIAF -record.references.viaf.pattern = "/^http:\\/\\/viaf.org\\/viaf\\/.*$/" +record.references.viaf.pattern = "/^https{0,1}:\\/\\/viaf.org\\/viaf\\/.*$/" [MoreLikeThis] useMoreLikeThisHandler = true diff --git a/local/jus/local/config/vufind/searches.ini b/local/jus/local/config/vufind/searches.ini index 9f84b4c3523..b93ca208e21 100644 --- a/local/jus/local/config/vufind/searches.ini +++ b/local/jus/local/config/vufind/searches.ini @@ -79,7 +79,7 @@ record.references.gnd.pattern = "/^http:\\/\\/d-nb.info\\/gnd\\/.*$/" record.references.dbpedia.label = DBPedia record.references.dbpedia.pattern = "/^http:\\/\\/dbpedia.org\\/resource\\/.*$/" record.references.viaf.label = VIAF -record.references.viaf.pattern = "/^http:\\/\\/viaf.org\\/viaf\\/.*$/" +record.references.viaf.pattern = "/^https{0,1}:\\/\\/viaf.org\\/viaf\\/.*$/" [MoreLikeThis] useMoreLikeThisHandler = true diff --git a/local/jus/productive/config/vufind/searches.ini b/local/jus/productive/config/vufind/searches.ini index ad0f8754803..b6d108ab068 100644 --- a/local/jus/productive/config/vufind/searches.ini +++ b/local/jus/productive/config/vufind/searches.ini @@ -79,7 +79,7 @@ record.references.gnd.pattern = "/^http:\\/\\/d-nb.info\\/gnd\\/.*$/" record.references.dbpedia.label = DBPedia record.references.dbpedia.pattern = "/^http:\\/\\/dbpedia.org\\/resource\\/.*$/" record.references.viaf.label = VIAF -record.references.viaf.pattern = "/^http:\\/\\/viaf.org\\/viaf\\/.*$/" +record.references.viaf.pattern = "/^https{0,1}:\\/\\/viaf.org\\/viaf\\/.*$/" [MoreLikeThis] useMoreLikeThisHandler = true diff --git a/local/linked/jusdev/config/vufind/searches.ini b/local/linked/jusdev/config/vufind/searches.ini index 4d841cd7397..1035309d491 100644 --- a/local/linked/jusdev/config/vufind/searches.ini +++ b/local/linked/jusdev/config/vufind/searches.ini @@ -76,4 +76,4 @@ record.references.gnd.pattern = "/^http:\\/\\/d-nb.info\\/gnd\\/.*$/" record.references.dbpedia.label = DBPedia record.references.dbpedia.pattern = "/^http:\\/\\/dbpedia.org\\/resource\\/.*$/" record.references.viaf.label = VIAF -record.references.viaf.pattern = "/^http:\\/\\/viaf.org\\/viaf\\/.*$/" \ No newline at end of file +record.references.viaf.pattern = "/^https{0,1}:\\/\\/viaf.org\\/viaf\\/.*$/" \ No newline at end of file From c96927a1dfcf5e8d61f54ad7cc44557659f53abd Mon Sep 17 00:00:00 2001 From: Lionel Walter Date: Mon, 1 Jul 2019 13:04:48 +0200 Subject: [PATCH 10/52] remove locally customized spellchecker --- local/classic/test/config/vufind/config.ini | 4 +- local/config/vufind/config_base.ini | 18 +- module/Swissbib/config/module.config.php | 2 - .../Factory/SolrDefaultBackendFactory.php | 4 - .../VuFind/Search/Results/Factory.php | 5 +- .../Swissbib/VuFind/Search/Solr/Factory.php | 86 ------- .../Solr/InjectSwissbibSpellingListener.php | 116 --------- .../Swissbib/VuFind/Search/Solr/Params.php | 2 - .../Swissbib/VuFind/Search/Solr/Results.php | 100 -------- .../VuFind/Search/Solr/SpellingProcessor.php | 242 ------------------ .../VuFind/Search/Solr/SpellingResults.php | 203 --------------- .../bootstrap3/templates/search/results.phtml | 2 +- .../search/spellingSuggestions.phtml | 79 +----- 13 files changed, 32 insertions(+), 831 deletions(-) diff --git a/local/classic/test/config/vufind/config.ini b/local/classic/test/config/vufind/config.ini index 1025ef8e9b5..0bd2569650f 100644 --- a/local/classic/test/config/vufind/config.ini +++ b/local/classic/test/config/vufind/config.ini @@ -14,8 +14,8 @@ timeout = 30 [Database] @include = './../../../../private_config_values/private_config_classic_test_database.conf' ; url -;[ElasticSearch] -;hosts[]=localhost:9201 +[ElasticSearch] +hosts[]=localhost:9201 [Authentication] hash_passwords = true diff --git a/local/config/vufind/config_base.ini b/local/config/vufind/config_base.ini index ddb11f189db..daf44f50467 100644 --- a/local/config/vufind/config_base.ini +++ b/local/config/vufind/config_base.ini @@ -265,7 +265,23 @@ college = REDIRECT_homeOrganization##homeOrganization ;logout = https://develop.swissbib.ch/Shibboleth.sso/Logout [Spelling] -enabled = false +enabled = true +; Number of suggestions to display on screen. This list is filtered from +; the number set in solr/biblio/conf/solrconfig.xml so they can differ. +limit = 3 +; Show the full modified search phrase on screen +; rather then just the suggested word +phrase = true +; Offer expansions on terms as well as basic replacements +expand = true +; Turning on 'simple' spell checking will improve performance, +; by ignoring the more complicated 'shingle' (mini phrases) +; based dictionary. +simple = false +; This setting skips spell checking for purely numeric searches; spelling +; suggestions on searches for ISBNs and OCLC numbers are not generally very +; useful. +skip_numeric = true [Social] comments = disabled diff --git a/module/Swissbib/config/module.config.php b/module/Swissbib/config/module.config.php index 7aede96c0dc..e178b85d04d 100644 --- a/module/Swissbib/config/module.config.php +++ b/module/Swissbib/config/module.config.php @@ -458,8 +458,6 @@ 'Swissbib\RecordDriver\SolrDefaultAdapter' => 'Swissbib\RecordDriver\Factory::getSolrDefaultAdapter', 'VuFind\Export' => 'Swissbib\Services\Factory::getExport', //no longer needed but test it more profoundly - 'sbSpellingProcessor' => 'Swissbib\VuFind\Search\Solr\Factory::getSpellchecker', - 'sbSpellingResults' => 'Swissbib\VuFind\Search\Solr\Factory::getSpellingResults', 'Swissbib\Hierarchy\SimpleTreeGenerator' => 'Swissbib\Hierarchy\Factory::getSimpleTreeGenerator', 'Swissbib\Hierarchy\MultiTreeGenerator' => 'Swissbib\Hierarchy\Factory::getMultiTreeGenerator', diff --git a/module/Swissbib/src/Swissbib/VuFind/Search/Factory/SolrDefaultBackendFactory.php b/module/Swissbib/src/Swissbib/VuFind/Search/Factory/SolrDefaultBackendFactory.php index 095393dd530..94667bfb649 100644 --- a/module/Swissbib/src/Swissbib/VuFind/Search/Factory/SolrDefaultBackendFactory.php +++ b/module/Swissbib/src/Swissbib/VuFind/Search/Factory/SolrDefaultBackendFactory.php @@ -74,10 +74,6 @@ protected function createListeners(Backend $backend) } else { $dictionaries = ['default', 'basicSpell']; } - $spellingListener = new InjectSwissbibSpellingListener( - $backend, $dictionaries - ); - $spellingListener->attach($events); $this->attachHighlightSolrConfigurator($backend); } diff --git a/module/Swissbib/src/Swissbib/VuFind/Search/Results/Factory.php b/module/Swissbib/src/Swissbib/VuFind/Search/Results/Factory.php index 7d78f2f3ad2..13f4d1f69d3 100644 --- a/module/Swissbib/src/Swissbib/VuFind/Search/Results/Factory.php +++ b/module/Swissbib/src/Swissbib/VuFind/Search/Results/Factory.php @@ -28,6 +28,7 @@ namespace Swissbib\VuFind\Search\Results; use Swissbib\VuFind\Search\Favorites\Results; +use VuFind\Search\Solr\SpellingProcessor; use Zend\ServiceManager\ServiceManager; /** @@ -59,9 +60,11 @@ public static function getSolr(ServiceManager $sm) */ $solr = $factory($sm, 'Solr'); + $config = $sm->get('VuFind\Config\PluginManager')->get('config'); $solr->setSpellingProcessor( - $sm->get("sbSpellingProcessor") + new SpellingProcessor($config->Spelling ?? null) ); + return $solr; } diff --git a/module/Swissbib/src/Swissbib/VuFind/Search/Solr/Factory.php b/module/Swissbib/src/Swissbib/VuFind/Search/Solr/Factory.php index 93f8c4a56a4..e69de29bb2d 100644 --- a/module/Swissbib/src/Swissbib/VuFind/Search/Solr/Factory.php +++ b/module/Swissbib/src/Swissbib/VuFind/Search/Solr/Factory.php @@ -1,86 +0,0 @@ - - * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License - * @link http://www.swissbib.org Main Page - */ -namespace Swissbib\VuFind\Search\Solr; - -use Zend\Config\Config as ZendConfig; -use Zend\ServiceManager\ServiceManager; - -/** - * Factory to create specialized types in the Search/Solr namespace - * - * @category Swissbib_VuFind - * @package VuFind_Search_Solr - * @author Guenter Hipler - * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License - * @link http://www.vufind.org Main Page - */ -class Factory -{ - /** - * GetSpellchecker - * - * @param ServiceManager $sm ServiceManager - * - * @return SpellingProcessor - */ - public static function getSpellchecker(ServiceManager $sm) - { - $config = $sm - ->get('VuFind\Config\PluginManager')->get('config'); - /** - * SpellConfig - * - * @var $spellConfig ZendConfig - * todo: no unit test so far - what happens if we provide an empty configu - * should be better as null - */ - $spellConfig = isset($config->Spelling) - ? $config->Spelling : new ZendConfig([]); - - /** - * Spelling Results - * - * @var $spellingResults SpellingResults - */ - $spellingResults = $sm->get("sbSpellingResults"); - - return new SpellingProcessor($spellingResults, $spellConfig); - } - - /** - * GetSpellingResults - * - * @param ServiceManager $sm ServiceManagers - * - * @return SpellingResults - */ - public static function getSpellingResults(ServiceManager $sm) - { - return new SpellingResults(); - } -} diff --git a/module/Swissbib/src/Swissbib/VuFind/Search/Solr/InjectSwissbibSpellingListener.php b/module/Swissbib/src/Swissbib/VuFind/Search/Solr/InjectSwissbibSpellingListener.php index ad6331c4b26..e69de29bb2d 100644 --- a/module/Swissbib/src/Swissbib/VuFind/Search/Solr/InjectSwissbibSpellingListener.php +++ b/module/Swissbib/src/Swissbib/VuFind/Search/Solr/InjectSwissbibSpellingListener.php @@ -1,116 +0,0 @@ - - * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License - * @link http://www.swissbib.org - */ -namespace Swissbib\VuFind\Search\Solr; - -use VuFind\Search\Solr\InjectSpellingListener as VFSpellingListener; -use VuFindSearch\Backend\Solr\Response\Json\Spellcheck; -use VuFindSearch\ParamBag; -use VuFindSearch\Query\Query; -use Zend\EventManager\EventInterface; - -/** - * InjectSwissbibSpellingListener - * - * @category Swissbib_VuFind - * @package VuFind_Search_Solr - * @author Guenter Hipler - * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License - * @link http://www.vufind.org Main Page - */ -class InjectSwissbibSpellingListener extends VFSpellingListener -{ - /** - * Set up spelling parameters. - * - * @param EventInterface $event Event - * - * @return EventInterface - */ - public function onSearchPre(EventInterface $event) - { - $backend = $event->getTarget(); - if ($backend === $this->backend) { - $params = $event->getParam('params'); - if ($params) { - // Set spelling parameters unless explicitly disabled: - $sc = $params->get('swissbibspellcheck'); - if (!empty($sc) && $sc[0] != 'false') { - - //remove the homegrown parameter only needed to activate - // the spellchecker in case of zero hits - $params->remove("swissbibspellcheck"); - $this->active = true; - if (empty($this->dictionaries)) { - throw new \Exception( - 'Spellcheck requested but no dictionary configured' - ); - } - - // Set relevant Solr parameters: - reset($this->dictionaries); - $params->set('spellcheck', 'true'); - $params->set( - 'spellcheck.dictionary', current($this->dictionaries) - ); - - // Turn on spellcheck.q generation in query builder: - $this->backend->getQueryBuilder() - ->setCreateSpellingQuery(true); - } - } - } - - return $event; - } - - /** - * AggregateSpellcheck - * - * @param Spellcheck $spellcheck Spellcheck - * @param string $query Query - * - * @return void - */ - protected function aggregateSpellcheck(Spellcheck $spellcheck, $query) - { - foreach ($this->dictionaries as $dictionary) { - $params = new ParamBag(); - - $params->set('spellcheck', 'true'); - $params->set('spellcheck.dictionary', $dictionary); - - $queryObj = new Query($query, 'AllFields'); - $collection = $this->backend->search($queryObj, 0, 0, $params); - - $spellcheck->mergeWith($collection->getSpellcheck()); - } - } -} diff --git a/module/Swissbib/src/Swissbib/VuFind/Search/Solr/Params.php b/module/Swissbib/src/Swissbib/VuFind/Search/Solr/Params.php index daf8c4b7976..da198cd230d 100644 --- a/module/Swissbib/src/Swissbib/VuFind/Search/Solr/Params.php +++ b/module/Swissbib/src/Swissbib/VuFind/Search/Solr/Params.php @@ -192,7 +192,6 @@ public function getBackendParameters() public function getSpellcheckBackendParameters() { $backendParams = parent::getBackendParameters(); - $backendParams->remove("spellcheck"); //with SOLR 4.3 AND is no longer the default parameter $backendParams->add("q.op", "AND"); @@ -200,7 +199,6 @@ public function getSpellcheckBackendParameters() //we need this homegrown param to control the behaviour of // InjectSwissbibSpellingListener //I don't see another possibilty yet - $backendParams->add("swissbibspellcheck", "true"); return $backendParams; } diff --git a/module/Swissbib/src/Swissbib/VuFind/Search/Solr/Results.php b/module/Swissbib/src/Swissbib/VuFind/Search/Solr/Results.php index 107e40067c6..da51fe72db7 100644 --- a/module/Swissbib/src/Swissbib/VuFind/Search/Solr/Results.php +++ b/module/Swissbib/src/Swissbib/VuFind/Search/Solr/Results.php @@ -191,104 +191,4 @@ public function getTarget() { return $this->target; } - - /** - * PerformSearch - * - * @throws \Exception - * @throws \VuFindSearch\Backend\Exception\BackendException - * - * @return void - */ - protected function performSearch() - { - $query = $this->getParams()->getQuery(); - $limit = $this->getParams()->getLimit(); - $offset = $this->getStartRecord() - 1; - $params = $this->getParams()->getBackendParameters(); - $searchService = $this->getSearchService(); - - try { - $collection = $searchService - ->search($this->backendId, $query, $offset, $limit, $params); - } catch (\VuFindSearch\Backend\Exception\BackendException $e) { - // If the query caused a parser error, see if we can clean it up: - if ($e->hasTag('VuFind\Search\ParserError') - && $newQuery = $this->fixBadQuery($query) - ) { - // We need to get a fresh set of $params, since the previous one was - // manipulated by the previous search() call. - $params = $this->getParams()->getBackendParameters(); - $collection = $searchService - ->search($this->backendId, $newQuery, $offset, $limit, $params); - } else { - throw $e; - } - } - - //code aus letztem VuFind Core - $this->responseFacets = $collection->getFacets(); - $this->resultTotal = $collection->getTotal(); - - if ($this->resultTotal == 0) { - - //we use spellchecking only in case of 0 hits - - $params = $this->getParams()->getSpellcheckBackendParameters(); - try { - $recordCollectionSpellingQuery = $searchService - ->search($this->backendId, $query, $offset, $limit, $params); - } catch (\VuFindSearch\Backend\Exception\BackendException $e) { - //todo: some kind of logging? - throw $e; - } - - // Processing of spelling suggestions - $spellcheck = $recordCollectionSpellingQuery->getSpellcheck(); - $this->spellingQuery = $spellcheck->getQuery(); - - //GH: I introduced a special type for suggestions provided by the SOLR - // index in opposition to the VF2 core implementation where a simple - // array structure is used a specialized type makes it much easier to - // use the suggestions in the view script - //the object variable suggestions is already used by VF2 core - $this->sbSuggestions = $this->getSpellingProcessor() - ->getSuggestions($spellcheck, $this->getParams()->getQuery()); - } - - // Construct record drivers for all the items in the response: - $this->results = $collection->getRecords(); - } - - /** - * GetSpellingProcessor - * - * @return mixed - */ - public function getSpellingProcessor() - { - if (null === $this->spellingProcessor) { - //$this->spellingProcessor = $this->getServiceLocator() - // ->get("sbSpellingProcessor"); - // - //only temporary, with VF4 we do not have ServiceLocator - //old Factory is creating the processor in this simple way - //todo !! - //but: we do have to analyze the new VF implementation - $this->spellingProcessor = new SpellingProcessor(new SpellingResults()); - } - - return $this->spellingProcessor; - } - - /** - * Turn the list of spelling suggestions into an array of urls - * for on-screen use to implement the suggestions. - * - * @return array Spelling suggestion data arrays - */ - public function getSpellingSuggestions() - { - return $this->sbSuggestions; - } } diff --git a/module/Swissbib/src/Swissbib/VuFind/Search/Solr/SpellingProcessor.php b/module/Swissbib/src/Swissbib/VuFind/Search/Solr/SpellingProcessor.php index 11d00333e8c..e69de29bb2d 100644 --- a/module/Swissbib/src/Swissbib/VuFind/Search/Solr/SpellingProcessor.php +++ b/module/Swissbib/src/Swissbib/VuFind/Search/Solr/SpellingProcessor.php @@ -1,242 +0,0 @@ - - * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License - * @link http://www.swissbib.org Main Page - */ -namespace Swissbib\VuFind\Search\Solr; - -use VuFind\Search\Solr\SpellingProcessor as VFSpellingProcessor; -use VuFindSearch\Backend\Solr\Response\Json\Spellcheck; -use VuFindSearch\Query\AbstractQuery; -use Zend\Config\Config as ZendConfig; - -/** - * Extended version of the VuFind Solr Spelling Processor (based on - * advanced Spellers like DirectIndexSpelling and .... ) - * - * @category Swissbib_VuFind - * @package VuFind_Search_Solr - * @author Guenter Hipler - * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License - * @link http://www.vufind.org Main Page - */ -class SpellingProcessor extends VFSpellingProcessor -{ - /** - * SpellingResults - * - * @var SpellingResults - */ - protected $spellingResults; - - /** - * Spelling limit - * - * @var int - */ - protected $spellingLimit = 3; - - /** - * TermSpellingLimits - * - * @var int - */ - protected $termSpellingLimits = 3; - - /** - * Spell check words with numbers in them? - * - * @var bool - */ - protected $spellSkipNumeric = true; - - /** - * Offer expansions on terms as well as basic replacements? - * - * @var bool - */ - protected $expand = true; - - /** - * Show the full modified search phrase on screen rather then just the suggested - * word? - * - * @var bool - */ - protected $phrase = false; - - /** - * Constructor - * - * @param SpellingResults $spellingResults Spelling configuration (optional) - * @param ZendConfig $config configuration - * - * todo: so far no unit tests - by now - * todo: I simply extended the class - * todo: because I had a problem with - * todo: the setSpellingProcessor - * method in VuFind\Search\Solr\Results - */ - public function __construct(SpellingResults $spellingResults, ZendConfig $config) - { - parent::__construct($config); - $this->spellingResults = $spellingResults; - } - - /** - * Are we skipping numeric words? - * - * @return bool - */ - public function shouldSkipNumericSpelling() - { - return $this->spellSkipNumeric; - } - - /** - * Get the spelling limit. - * - * @return int - */ - public function getSpellingLimit() - { - return $this->spellingLimit; - } - - /** - * Input Tokenizer - Specifically for spelling purposes - * - * Because of its focus on spelling, these tokens are unsuitable - * for actual searching. They are stripping important search data - * such as joins and groups, simply because they don't need to be - * spellchecked. - * - * @param string $input Query to tokenize - * - * @return array Tokenized array - */ - public function tokenize($input) - { - //at the moment not used by swissbib (maybe the blacklist - not used terms - // like and / or / not .. but should be handled by the search engine - - return []; - } - - /** - * Get raw spelling suggestions for a query. - * - * @param Spellcheck $spellcheck Complete spellcheck information - * @param AbstractQuery $query Query for which info should be retrieved - * - * @return array - * @throws \Exception - */ - public function getSuggestions(Spellcheck $spellcheck, AbstractQuery $query) - { - if (!$this->spellingResults->hasSuggestions()) { - $this->spellingResults->setSpellingQuery($query); - $i = 1; - foreach ($spellcheck as $term => $info) { - if ($term == "collation") { - if (is_array($info)) { - $this->spellingResults->addCollocationSOLRStructure($info); - } - } elseif (++$i && $i <= $this->getSpellingLimit() - && array_key_exists("suggestion", $info) - ) { - //no so called collation suggestions are based on the - // single term part of the spelling query - $numberTermSuggestions = 1; - foreach ($info['suggestion'] as $termSuggestion) { - $numberTermSuggestions++; - if ($numberTermSuggestions > $this->termSpellingLimits) { - break; - } - $this->spellingResults->addTerm( - $term, $termSuggestion['word'], $termSuggestion['freq'] - ); - } - } - } - } - - return $this->spellingResults; - } - - /** - * Support method for getSuggestions() - * - * @param AbstractQuery $query Query for which info should be retrieved - * @param array $info Spelling suggestion information - * - * @return array - * @throws \Exception - */ - protected function formatAndFilterSuggestions($query, $info) - { - // Validate response format - if (isset($info['suggestion'][0]) && !is_array($info['suggestion'][0])) { - throw new \Exception( - 'Unexpected suggestion format; spellcheck.extendedResults' - . ' must be set to true.' - ); - } - $limit = $this->getSpellingLimit(); - $suggestions = []; - foreach ($info['suggestion'] as $suggestion) { - if (count($suggestions) >= $limit) { - break; - } - $word = $suggestion['word']; - if (!$this->shouldSkipTerm($query, $word, true)) { - $suggestions[$word] = $suggestion['freq']; - } - } - return $suggestions; - } - - /** - * Should we skip the specified term? - * - * @param AbstractQuery $query Query for which info should be retrieved - * @param string $term Term to check - * @param bool $queryContains Should we skip the term if it is found - * in the query (true), or should we skip the - * term if it is NOT found in the - * query (false)? - * - * @return bool - */ - protected function shouldSkipTerm($query, $term, $queryContains) - { - // If term is numeric and we're in "skip numeric" mode, we should skip it: - if ($this->shouldSkipNumericSpelling() && is_numeric($term)) { - return true; - } - // We should also skip terms already contained within the query: - return $queryContains == $query->containsTerm($term); - } -} diff --git a/module/Swissbib/src/Swissbib/VuFind/Search/Solr/SpellingResults.php b/module/Swissbib/src/Swissbib/VuFind/Search/Solr/SpellingResults.php index 8a67c8ead16..e69de29bb2d 100644 --- a/module/Swissbib/src/Swissbib/VuFind/Search/Solr/SpellingResults.php +++ b/module/Swissbib/src/Swissbib/VuFind/Search/Solr/SpellingResults.php @@ -1,203 +0,0 @@ - - * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License - * @link http://www.swissbib.org Main Page - */ -namespace Swissbib\VuFind\Search\Solr; - -use VuFindSearch\Query\AbstractQuery; - -/** - * Spelling results is the container type to collect spelling suggestions provided - * by the SOLR SearchEngine - * Actually we distinguish collocation suggestions (multiple terms in sequence or - * simple single term suggestions - * term suggestions are variants of a token part of the original query - * - * @category Swissbib_VuFind - * @package VuFind_Search_Solr - * @author Guenter Hipler - * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License - * @link http://www.swissbib.org Main Page - */ -class SpellingResults -{ - /** - * Holds the collocation values and number of documents - * - * @var array - */ - protected $collocations = []; - - /** - * Holds the suggested term values related to their key with number - * of documents to be expected - * - * @var array - */ - protected $terms = []; - - /** - * SpellingQuery - * - * @var AbstractQuery - */ - protected $spellingQuery; - - /** - * AddCollocation - * method expects collocation and frequency explicitly - * (processing has to be done by the client) - * - * @param String $collocation Collocation - * @param String $frequency Frequency - * - * @return void - */ - public function addCollocation($collocation, $frequency) - { - $this->collocations[] = [$collocation, $frequency]; - } - - /** - * AddCollocationSOLRStructure - * - * @param array $solrInfoStructure SolrInfoStructure - * - * @return void - */ - public function addCollocationSOLRStructure(array $solrInfoStructure) - { - $collationSuggestion = []; - //if term indicates a collation the info variable (again an array) - // consists of three parts - //[0][0] => "collationQuery" string as key - //[0][1] => the collation query provided by SOLR istself - //[1][0] => "hits" string as key - //[1][1] => number of hits for the collation query suggested by SOLR - //[2][..] => a list of so called "misspellingAndCorrections" for each - // of the tokens part of the collation query - //I don't use this at the moment - foreach ($solrInfoStructure as $infoValues) { - if ($infoValues[0] == "collationQuery") { - $collationSuggestion["query"] = $infoValues[1]; - } elseif ($infoValues[0] == "hits") { - $collationSuggestion["hits"] = $infoValues[1]; - } - } - - if (array_key_exists("query", $collationSuggestion) - && array_key_exists("hits", $collationSuggestion) - ) { - $this->collocations[] = $collationSuggestion; - } - } - - /** - * AddTerm - * - * @param String $key Key - * @param String $value Value - * @param String $frequency Frequency - * - * @return void - */ - public function addTerm($key, $value, $frequency) - { - $this->terms[$key][] = ['query' => $value, 'hits' => $frequency]; - } - - /** - * HasSuggestions - * - * @return bool - */ - public function hasSuggestions() - { - return count($this->collocations) > 0 || count($this->terms) > 0; - } - - /** - * HasCollocations - * - * @return bool - */ - public function hasCollocations() - { - return count($this->collocations) > 0; - } - - /** - * HasTerms - * - * @return bool - */ - public function hasTerms() - { - return count($this->terms) > 0; - } - - /** - * SetSpellingQuery - * - * @param AbstractQuery $query Query - * - * @return void - */ - public function setSpellingQuery(AbstractQuery $query) - { - $this->spellingQuery = $query; - } - - /** - * GetSpellingQuery - * - * @return AbstractQuery - */ - public function getSpellingQuery() - { - return $this->spellingQuery; - } - - /** - * GetCollocationSuggestions - * - * @return array - */ - public function getCollocationSuggestions() - { - return $this->collocations; - } - - /** - * GetTermSuggestions - * - * @return array - */ - public function getTermSuggestions() - { - return $this->terms; - } -} diff --git a/themes/bootstrap3/templates/search/results.phtml b/themes/bootstrap3/templates/search/results.phtml index 46e1b8e21a2..719e8fb5f0d 100644 --- a/themes/bootstrap3/templates/search/results.phtml +++ b/themes/bootstrap3/templates/search/results.phtml @@ -1,6 +1,6 @@ results->getUrlQuery()->isQuerySuppressed() ? '' : $this->params->getDisplayQuery(); + $lookfor = $this->results->getUrlQuery()->isQuerySuppressed() ? '' : $this->params->getDisugplayQuery(); if (isset($this->overrideTitle)) { $this->headTitle($this->overrideTitle); } else { diff --git a/themes/sbvfrd/templates/search/spellingSuggestions.phtml b/themes/sbvfrd/templates/search/spellingSuggestions.phtml index e19b7560440..5a744d6c110 100644 --- a/themes/sbvfrd/templates/search/spellingSuggestions.phtml +++ b/themes/sbvfrd/templates/search/spellingSuggestions.phtml @@ -1,78 +1,15 @@ -results->getSpellingSuggestions(); -$query = $this->results->getUrlQuery(); -?> -

added

results; -$label = $results->getResultTotal() > 0 - ? '' . $this->transEsc('spell_suggest') . ':' - : $this->transEsc('nohit_spelling') . ':'; -$suggestions = $this->search()->renderSpellingSuggestions($label, $results, $this); +$label = "

youhou

"; +$suggestionsFixed = $this->search()->renderSpellingSuggestions($label, $results, $this); ?> - - - - - - - - - - -
-
-

transEsc('nohit_heading')?>

-
-
+ + -hasSuggestions()) : ?> - -
-

transEsc('Your search terms')?>: escapeHtml($suggestions->getSpellingQuery()->getAllTerms()) ?>

-
- -
-

transEsc('nohit_spelling') ?>

- getSpellingQuery()->getString() ?> - - hasCollocations()) :?> - - getCollocationSuggestions() as $collocation) :?> -

escapeHtml($collocation['query']) ?>

- - - - hasTerms()) :?> - - getTermSuggestions() as $key => $termValues) :?> - - -

escapeHtml($termValue['query']) ?>

- - - - -
- - - - - - -
-

transEsc('nohit_suggest') ?>

-

transEsc('nohit_text3') ?>transEsc('worldcat') ?>

-
-
-

transEsc('nohit_tip') ?>

-

transEsc('Search Tips') ?>

-

transEsc('Advanced Search')?> transEsc('nohit_text5') ?>

-
- - - +results->getSpellingSuggestions(); +$query = $this->results->getUrlQuery(); +?> From 574d8ef71fe30a58c0d1036fbcb22abe7e5d3726 Mon Sep 17 00:00:00 2001 From: Lionel Walter Date: Mon, 1 Jul 2019 16:13:41 +0200 Subject: [PATCH 11/52] take the first proposition for each term first --- local/config/vufind/config_base.ini | 4 +- .../View/Helper/RenderSuggestions.php | 107 ++++++++++++++++++ .../search/spellingSuggestions.phtml | 34 ++++-- themes/sbvfrd/theme.config.php | 2 + 4 files changed, 135 insertions(+), 12 deletions(-) create mode 100644 module/Swissbib/src/Swissbib/View/Helper/RenderSuggestions.php diff --git a/local/config/vufind/config_base.ini b/local/config/vufind/config_base.ini index daf44f50467..43455c9f23e 100644 --- a/local/config/vufind/config_base.ini +++ b/local/config/vufind/config_base.ini @@ -271,9 +271,9 @@ enabled = true limit = 3 ; Show the full modified search phrase on screen ; rather then just the suggested word -phrase = true +phrase = false ; Offer expansions on terms as well as basic replacements -expand = true +expand = false ; Turning on 'simple' spell checking will improve performance, ; by ignoring the more complicated 'shingle' (mini phrases) ; based dictionary. diff --git a/module/Swissbib/src/Swissbib/View/Helper/RenderSuggestions.php b/module/Swissbib/src/Swissbib/View/Helper/RenderSuggestions.php new file mode 100644 index 00000000000..a4d0c5a0501 --- /dev/null +++ b/module/Swissbib/src/Swissbib/View/Helper/RenderSuggestions.php @@ -0,0 +1,107 @@ + + * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License + * @link http://vufind.org/wiki/vufind2:developer_manual Wiki + */ +namespace Swissbib\View\Helper; + +use Swissbib\VuFind\Db\Row\NationalLicenceUser; +use VuFind\Search\UrlQueryHelper; +use VuFindSearch\Query\Query; +use Zend\View\Helper\AbstractHelper; + +/** + * Render suggestions + * + * @category Swissbib_VuFind + * @package View_Helper + * @author Lionel Walter + * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License + * @link http://vufind.org/wiki/vufind2:developer_manual Wiki + */ +class RenderSuggestions extends AbstractHelper +{ + /** + * Render suggestions + * + * @param \VuFind\Search\Base\Results $results Results object + * @param \Zend\View\Renderer\PhpRenderer $view View renderer object + * + * @return string + */ + public function __invoke($results, $view) + { + $spellingSuggestions = $results->getSpellingSuggestions(); + if (empty($spellingSuggestions)) { + return ''; + } + + $html = ''; + + $suggested = []; + foreach ($spellingSuggestions as $term => $details) { + foreach ($details['suggestions'] as $word => $data) { + $suggested[$term] = $word; + break;//only the first suggestion + } + } + + /** + * Initial Query + * + * @var Query $initialQuery + */ + $initialQuery = $results->getParams()->getQuery(); + + + foreach ($suggested as $term => $suggestion) { + $initialQuery->replaceTerm($term, $suggestion); + } + + $text = $initialQuery->getString(); + + /** + * Url Query Helper + * + * @var UrlQueryHelper $query + */ + $query = $results->getUrlQuery(); + + foreach ($suggested as $term => $suggestion) { + $query = $query->replaceTerm($term, $suggestion); + } + + + $href=$query->getParams(); + + + $html .= '' . $view->escapeHtml($text) + . ''; + + + return $html; + } +} diff --git a/themes/sbvfrd/templates/search/spellingSuggestions.phtml b/themes/sbvfrd/templates/search/spellingSuggestions.phtml index 5a744d6c110..3cbfdfd1a3e 100644 --- a/themes/sbvfrd/templates/search/spellingSuggestions.phtml +++ b/themes/sbvfrd/templates/search/spellingSuggestions.phtml @@ -1,15 +1,29 @@ -

added

results; -$label = "

youhou

"; -$suggestionsFixed = $this->search()->renderSpellingSuggestions($label, $results, $this); +$label=""; +$suggestionsNew = $this->renderSuggestions($results, $this); ?> - - - -results->getSpellingSuggestions(); -$query = $this->results->getUrlQuery(); -?> + +
+
+

transEsc('nohit_heading')?>

+
+
+ +
+

transEsc('nohit_spelling') ?>

+

+
+ +
+

transEsc('nohit_suggest') ?>

+

transEsc('nohit_text3') ?>transEsc('worldcat') ?>

+
+
+

transEsc('nohit_tip') ?>

+

transEsc('Search Tips') ?>

+

transEsc('Advanced Search')?> transEsc('nohit_text5') ?>

+
+ diff --git a/themes/sbvfrd/theme.config.php b/themes/sbvfrd/theme.config.php index d6a4a1dfe00..86a25ddb8ec 100644 --- a/themes/sbvfrd/theme.config.php +++ b/themes/sbvfrd/theme.config.php @@ -50,6 +50,7 @@ 'translateFacets' => 'Swissbib\View\Helper\Swissbib\Factory::getFacetTranslator', 'formatRelatedEntries' => 'Swissbib\View\Helper\Swissbib\Factory::getFormatRelatedEntries', \Swissbib\VuFind\View\Helper\Root\Translate::class => 'Zend\ServiceManager\Factory\InvokableFactory', + 'Swissbib\View\Helper\RenderSuggestions' => 'Zend\ServiceManager\Factory\InvokableFactory', ], 'aliases' => [ 'auth' => 'VuFind\View\Helper\Root\Auth', @@ -59,6 +60,7 @@ 'recordLink' => 'Swissbib\View\Helper\RecordLink', 'searchtabs' => 'Swissbib\VuFind\View\Helper\Root\SearchTabs', 'translate' => \Swissbib\VuFind\View\Helper\Root\Translate::class, + 'renderSuggestions' => 'Swissbib\View\Helper\RenderSuggestions', ], ] ]; From cd85be38584dff9ebc2b985e6c7c389fde7e0ab6 Mon Sep 17 00:00:00 2001 From: Lionel Walter Date: Mon, 1 Jul 2019 16:33:32 +0200 Subject: [PATCH 12/52] overwrite core template --- .../SpellingSuggestions.phtml} | 0 themes/sbvfrd/templates/search/results.phtml | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) rename themes/sbvfrd/templates/{search/spellingSuggestions.phtml => Recommend/SpellingSuggestions.phtml} (100%) diff --git a/themes/sbvfrd/templates/search/spellingSuggestions.phtml b/themes/sbvfrd/templates/Recommend/SpellingSuggestions.phtml similarity index 100% rename from themes/sbvfrd/templates/search/spellingSuggestions.phtml rename to themes/sbvfrd/templates/Recommend/SpellingSuggestions.phtml diff --git a/themes/sbvfrd/templates/search/results.phtml b/themes/sbvfrd/templates/search/results.phtml index 44df840e105..22585eb7641 100644 --- a/themes/sbvfrd/templates/search/results.phtml +++ b/themes/sbvfrd/templates/search/results.phtml @@ -94,7 +94,7 @@ - render('search/spellingSuggestions.phtml')?> + render('Recommend/SpellingSuggestions.phtml')?> 0): // only display these at very top if we have results ?> results->getRecommendations('top') as $current): ?> From 110c27f54aa33145c2cef9f1b49fd0426a8222c8 Mon Sep 17 00:00:00 2001 From: Lionel Walter Date: Mon, 1 Jul 2019 16:51:49 +0200 Subject: [PATCH 13/52] add missing configurations to baselbern local --- local/baselbern/local/config/vufind/Holdings.ini | 3 +++ 1 file changed, 3 insertions(+) diff --git a/local/baselbern/local/config/vufind/Holdings.ini b/local/baselbern/local/config/vufind/Holdings.ini index ba5a54173ec..44ffcf790ec 100644 --- a/local/baselbern/local/config/vufind/Holdings.ini +++ b/local/baselbern/local/config/vufind/Holdings.ini @@ -9,6 +9,9 @@ SBT = http://aleph.sbt.ti.ch,SBT01 ABN = http://aleph.ag.ch,ABN01 LIBIB = http://aleph.lbfl.li,LLB01 +[SpecialNetworks] +RERO = https://services.test.rero.ch,RERO + ; true : API activated / false or unconfigured : API not activated [Restful] IDSBB = true From d91ec3435ab64149dda95aafa388a9abd9da41af Mon Sep 17 00:00:00 2001 From: Lionel Walter Date: Mon, 1 Jul 2019 17:05:51 +0200 Subject: [PATCH 14/52] adapt spelling suggestions for orange --- .../Recommend/SpellingSuggestions.phtml | 7 +- .../Recommend/SpellingSuggestions.phtml | 36 +++++++ .../search/spellingSuggestions.phtml | 99 ------------------- 3 files changed, 39 insertions(+), 103 deletions(-) create mode 100644 themes/sbvfrdmulti/templates/Recommend/SpellingSuggestions.phtml delete mode 100644 themes/sbvfrdmulti/templates/search/spellingSuggestions.phtml diff --git a/themes/sbvfrd/templates/Recommend/SpellingSuggestions.phtml b/themes/sbvfrd/templates/Recommend/SpellingSuggestions.phtml index 3cbfdfd1a3e..2ac1ecb1e9b 100644 --- a/themes/sbvfrd/templates/Recommend/SpellingSuggestions.phtml +++ b/themes/sbvfrd/templates/Recommend/SpellingSuggestions.phtml @@ -1,7 +1,6 @@ results; -$label=""; -$suggestionsNew = $this->renderSuggestions($results, $this); +$suggestions = $this->renderSuggestions($results, $this); ?> @@ -11,10 +10,10 @@ $suggestionsNew = $this->renderSuggestions($results, $this);

transEsc('nohit_heading')?>

- +

transEsc('nohit_spelling') ?>

-

+

diff --git a/themes/sbvfrdmulti/templates/Recommend/SpellingSuggestions.phtml b/themes/sbvfrdmulti/templates/Recommend/SpellingSuggestions.phtml new file mode 100644 index 00000000000..91cd2af0492 --- /dev/null +++ b/themes/sbvfrdmulti/templates/Recommend/SpellingSuggestions.phtml @@ -0,0 +1,36 @@ +results; +$suggestions = $this->renderSuggestions($results, $this); +?> + + + +
+
+

transEsc('nohit_heading')?>

+
+
+ +
+

transEsc('nohit_spelling') ?>

+

+
+ +
+

transEsc('nohit_suggest') ?>

+ transEsc('nohit_text1') ?> + transEsc('nohit_text2') ?> + +

transEsc('nohit_text3') ?>transEsc('tab.summon') ?>

+ +

transEsc('nohit_text3') ?>transEsc('swissbib') ?>

+

transEsc('nohit_text3') ?>transEsc('worldcat') ?>

+
+ +
+

transEsc('nohit_tip') ?>

+

transEsc('Search Tips')?>

+

transEsc('helppage.faq')?>

+

transEsc('Advanced Search')?> transEsc('nohit_text5') ?>

+
+ \ No newline at end of file diff --git a/themes/sbvfrdmulti/templates/search/spellingSuggestions.phtml b/themes/sbvfrdmulti/templates/search/spellingSuggestions.phtml deleted file mode 100644 index 93802a6aef8..00000000000 --- a/themes/sbvfrdmulti/templates/search/spellingSuggestions.phtml +++ /dev/null @@ -1,99 +0,0 @@ -results->getSpellingSuggestions(); -$query = $this->results->getUrlQuery(); -?> - - -
-
-

transEsc('nohit_heading')?>

-
-
- - - -hasSuggestions()) : ?> - -
-

transEsc('Your search terms')?>: getSpellingQuery()->getAllTerms() ?>

-
- -
-

transEsc('nohit_spelling') ?>

- getSpellingQuery()->getAllTerms() ?> - - hasCollocations()) :?> - - getCollocationSuggestions() as $collocation) :?> -

escapeHtml($collocation['query']) ?>

- - - - hasTerms()) :?> - - getTermSuggestions() as $key => $termValues) :?> - - -

escapeHtml($termValue['query']) ?>

- - - - -
- - - - - - - $details): - ?> - - -
-

transEsc('Your search terms')?>: escapeHtml($term) ?>

-
- -
-

transEsc('nohit_spelling') ?>

- - $data) : ?> - -

escapeHtml($data['new_term']) ?>

- - - -
- - - - - - - - -
-

transEsc('nohit_suggest') ?>

- transEsc('nohit_text1') ?> - transEsc('nohit_text2') ?> - -

transEsc('nohit_text3') ?>transEsc('tab.summon') ?>

- -

transEsc('nohit_text3') ?>transEsc('swissbib') ?>

-

transEsc('nohit_text3') ?>transEsc('worldcat') ?>

-
- -
-

transEsc('nohit_tip') ?>

-

transEsc('Search Tips')?>

-

transEsc('helppage.faq')?>

-

transEsc('Advanced Search')?> transEsc('nohit_text5') ?>

-
- - - - From ef5de0856bb2651d88d8d7363ba412f4725eaabc Mon Sep 17 00:00:00 2001 From: Lionel Walter Date: Mon, 1 Jul 2019 17:07:05 +0200 Subject: [PATCH 15/52] remove files not used any more --- module/Swissbib/src/Swissbib/VuFind/Search/Solr/Factory.php | 0 .../VuFind/Search/Solr/InjectSwissbibSpellingListener.php | 0 .../src/Swissbib/VuFind/Search/Solr/SpellingProcessor.php | 0 .../Swissbib/src/Swissbib/VuFind/Search/Solr/SpellingResults.php | 0 4 files changed, 0 insertions(+), 0 deletions(-) delete mode 100644 module/Swissbib/src/Swissbib/VuFind/Search/Solr/Factory.php delete mode 100644 module/Swissbib/src/Swissbib/VuFind/Search/Solr/InjectSwissbibSpellingListener.php delete mode 100644 module/Swissbib/src/Swissbib/VuFind/Search/Solr/SpellingProcessor.php delete mode 100644 module/Swissbib/src/Swissbib/VuFind/Search/Solr/SpellingResults.php diff --git a/module/Swissbib/src/Swissbib/VuFind/Search/Solr/Factory.php b/module/Swissbib/src/Swissbib/VuFind/Search/Solr/Factory.php deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/module/Swissbib/src/Swissbib/VuFind/Search/Solr/InjectSwissbibSpellingListener.php b/module/Swissbib/src/Swissbib/VuFind/Search/Solr/InjectSwissbibSpellingListener.php deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/module/Swissbib/src/Swissbib/VuFind/Search/Solr/SpellingProcessor.php b/module/Swissbib/src/Swissbib/VuFind/Search/Solr/SpellingProcessor.php deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/module/Swissbib/src/Swissbib/VuFind/Search/Solr/SpellingResults.php b/module/Swissbib/src/Swissbib/VuFind/Search/Solr/SpellingResults.php deleted file mode 100644 index e69de29bb2d..00000000000 From 11e4a8791af5055c1479ee8760c809c7e40a1fbc Mon Sep 17 00:00:00 2001 From: Lionel Walter Date: Mon, 1 Jul 2019 17:18:50 +0200 Subject: [PATCH 16/52] first step back --- .../Solr/InjectSwissbibSpellingListener.php | 87 +++++++++++++++++++ 1 file changed, 87 insertions(+) create mode 100644 module/Swissbib/src/Swissbib/VuFind/Search/Solr/InjectSwissbibSpellingListener.php diff --git a/module/Swissbib/src/Swissbib/VuFind/Search/Solr/InjectSwissbibSpellingListener.php b/module/Swissbib/src/Swissbib/VuFind/Search/Solr/InjectSwissbibSpellingListener.php new file mode 100644 index 00000000000..139d8be70d4 --- /dev/null +++ b/module/Swissbib/src/Swissbib/VuFind/Search/Solr/InjectSwissbibSpellingListener.php @@ -0,0 +1,87 @@ + + * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License + * @link http://www.swissbib.org + */ +namespace Swissbib\VuFind\Search\Solr; +use VuFind\Search\Solr\InjectSpellingListener as VFSpellingListener; +use VuFindSearch\Backend\Solr\Response\Json\Spellcheck; +use VuFindSearch\ParamBag; +use VuFindSearch\Query\Query; +use Zend\EventManager\EventInterface; +/** + * InjectSwissbibSpellingListener + * + * @category Swissbib_VuFind + * @package VuFind_Search_Solr + * @author Guenter Hipler + * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License + * @link http://www.vufind.org Main Page + */ +class InjectSwissbibSpellingListener extends VFSpellingListener +{ + /** + * Set up spelling parameters. + * + * @param EventInterface $event Event + * + * @return EventInterface + */ + public function onSearchPre(EventInterface $event) + { + $backend = $event->getTarget(); + if ($backend === $this->backend) { + $params = $event->getParam('params'); + if ($params) { + // Set spelling parameters unless explicitly disabled: + $sc = $params->get('swissbibspellcheck'); + if (!empty($sc) && $sc[0] != 'false') { + //remove the homegrown parameter only needed to activate + // the spellchecker in case of zero hits + $params->remove("swissbibspellcheck"); + $this->active = true; + if (empty($this->dictionaries)) { + throw new \Exception( + 'Spellcheck requested but no dictionary configured' + ); + } + // Set relevant Solr parameters: + reset($this->dictionaries); + $params->set('spellcheck', 'true'); + $params->set( + 'spellcheck.dictionary', current($this->dictionaries) + ); + // Turn on spellcheck.q generation in query builder: + $this->backend->getQueryBuilder() + ->setCreateSpellingQuery(true); + } + } + } + return $event; + } +} \ No newline at end of file From 9ec0af6db7861b97cd6dda8e33e9139867116f6e Mon Sep 17 00:00:00 2001 From: Lionel Walter Date: Mon, 1 Jul 2019 17:37:15 +0200 Subject: [PATCH 17/52] fix typo --- themes/bootstrap3/templates/search/results.phtml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/themes/bootstrap3/templates/search/results.phtml b/themes/bootstrap3/templates/search/results.phtml index 719e8fb5f0d..46e1b8e21a2 100644 --- a/themes/bootstrap3/templates/search/results.phtml +++ b/themes/bootstrap3/templates/search/results.phtml @@ -1,6 +1,6 @@ results->getUrlQuery()->isQuerySuppressed() ? '' : $this->params->getDisugplayQuery(); + $lookfor = $this->results->getUrlQuery()->isQuerySuppressed() ? '' : $this->params->getDisplayQuery(); if (isset($this->overrideTitle)) { $this->headTitle($this->overrideTitle); } else { From ecc7143d9b6fa785739363eaf65fca1724e108f8 Mon Sep 17 00:00:00 2001 From: edelm Date: Mon, 3 Jun 2019 18:16:52 +0200 Subject: [PATCH 18/52] make autosuggest work for trefferliste and vollanzeige --- themes/sbvfrd/templates/layout/layout.phtml | 17 ++++++++++------- themes/sbvfrd/templates/search/searchbox.phtml | 11 +++++++++++ 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/themes/sbvfrd/templates/layout/layout.phtml b/themes/sbvfrd/templates/layout/layout.phtml index b02b3389e0e..106b86a6f17 100644 --- a/themes/sbvfrd/templates/layout/layout.phtml +++ b/themes/sbvfrd/templates/layout/layout.phtml @@ -52,7 +52,7 @@ 'autosuggest.section.label.titles' => 'autosuggest.section.label.titles', 'autosuggest.section.label.authors' => 'autosuggest.section.label.authors', 'autosuggest.section.label.topics' => 'autosuggest.section.label.topics', - 'available' => 'available_icon', + 'available' => 'lendable_available', 'unavailable' => 'unavailable', 'no_ava_info' => 'no_ava_info', 'lookOnSite' => 'lookOnSite' @@ -108,9 +108,10 @@ JS; // Append TypeScript generated output $this->headScript()->appendFile("swissbib/swissbib.ts.js"); - // Extend swissbib global object by autocomplete configuration - $autoSuggestConfig = json_encode($this->autoSuggestConfig()->toArray()); - $swissbibObjectExtension = <<layout()->searchbox)) { + // Extend swissbib global object by autocomplete configuration + $autoSuggestConfig = json_encode($this->autoSuggestConfig()->toArray()); + $swissbibObjectExtension = <<headScript()->appendScript($swissbibObjectExtension); + $this->headScript()->appendScript($swissbibObjectExtension); + } ?> headScript()?> @@ -132,6 +133,7 @@ JS; // this covers case 1. Cases 2 and 3 are then covered by logic below. if (!isset($this->layout()->searchbox)) { $this->layout()->searchbox = $this->render('search/searchbox.phtml'); + echo $this->inlineScript(); } ?> @@ -171,7 +173,6 @@ if (!isset($this->layout()->searchbox)) {
- + + diff --git a/themes/sbvfrd/templates/search/searchbox.phtml b/themes/sbvfrd/templates/search/searchbox.phtml index ceccb6bd9da..4355eb28d8b 100644 --- a/themes/sbvfrd/templates/search/searchbox.phtml +++ b/themes/sbvfrd/templates/search/searchbox.phtml @@ -18,6 +18,17 @@ $lastLimit = $this->searchMemory()->getLastLimit($this->searchClassId); $searchtabs = $this->searchtabs($this->searchClassId, $this->lookfor, $this->searchIndex, $this->searchType); +// Extend swissbib global object by autocomplete configuration +$autoSuggestConfig = json_encode($this->autoSuggestConfig($this->searchClassId)->toArray()); +$swissbibObjectExtension = <<inlineScript()->appendScript($swissbibObjectExtension); ?> searchType == 'advanced'): ?> From f9079b9735ed5fa6e5a7eea9becf9ece9e812d18 Mon Sep 17 00:00:00 2001 From: Lionel Walter Date: Mon, 1 Jul 2019 19:28:35 +0200 Subject: [PATCH 19/52] put default search without spellcheck again --- local/config/vufind/config_base.ini | 18 +----- .../Factory/SolrDefaultBackendFactory.php | 4 ++ .../Swissbib/VuFind/Search/Solr/Params.php | 2 + .../Swissbib/VuFind/Search/Solr/Results.php | 64 +++++++++++++++++++ 4 files changed, 71 insertions(+), 17 deletions(-) diff --git a/local/config/vufind/config_base.ini b/local/config/vufind/config_base.ini index 43455c9f23e..ddb11f189db 100644 --- a/local/config/vufind/config_base.ini +++ b/local/config/vufind/config_base.ini @@ -265,23 +265,7 @@ college = REDIRECT_homeOrganization##homeOrganization ;logout = https://develop.swissbib.ch/Shibboleth.sso/Logout [Spelling] -enabled = true -; Number of suggestions to display on screen. This list is filtered from -; the number set in solr/biblio/conf/solrconfig.xml so they can differ. -limit = 3 -; Show the full modified search phrase on screen -; rather then just the suggested word -phrase = false -; Offer expansions on terms as well as basic replacements -expand = false -; Turning on 'simple' spell checking will improve performance, -; by ignoring the more complicated 'shingle' (mini phrases) -; based dictionary. -simple = false -; This setting skips spell checking for purely numeric searches; spelling -; suggestions on searches for ISBNs and OCLC numbers are not generally very -; useful. -skip_numeric = true +enabled = false [Social] comments = disabled diff --git a/module/Swissbib/src/Swissbib/VuFind/Search/Factory/SolrDefaultBackendFactory.php b/module/Swissbib/src/Swissbib/VuFind/Search/Factory/SolrDefaultBackendFactory.php index 94667bfb649..095393dd530 100644 --- a/module/Swissbib/src/Swissbib/VuFind/Search/Factory/SolrDefaultBackendFactory.php +++ b/module/Swissbib/src/Swissbib/VuFind/Search/Factory/SolrDefaultBackendFactory.php @@ -74,6 +74,10 @@ protected function createListeners(Backend $backend) } else { $dictionaries = ['default', 'basicSpell']; } + $spellingListener = new InjectSwissbibSpellingListener( + $backend, $dictionaries + ); + $spellingListener->attach($events); $this->attachHighlightSolrConfigurator($backend); } diff --git a/module/Swissbib/src/Swissbib/VuFind/Search/Solr/Params.php b/module/Swissbib/src/Swissbib/VuFind/Search/Solr/Params.php index da198cd230d..daf8c4b7976 100644 --- a/module/Swissbib/src/Swissbib/VuFind/Search/Solr/Params.php +++ b/module/Swissbib/src/Swissbib/VuFind/Search/Solr/Params.php @@ -192,6 +192,7 @@ public function getBackendParameters() public function getSpellcheckBackendParameters() { $backendParams = parent::getBackendParameters(); + $backendParams->remove("spellcheck"); //with SOLR 4.3 AND is no longer the default parameter $backendParams->add("q.op", "AND"); @@ -199,6 +200,7 @@ public function getSpellcheckBackendParameters() //we need this homegrown param to control the behaviour of // InjectSwissbibSpellingListener //I don't see another possibilty yet + $backendParams->add("swissbibspellcheck", "true"); return $backendParams; } diff --git a/module/Swissbib/src/Swissbib/VuFind/Search/Solr/Results.php b/module/Swissbib/src/Swissbib/VuFind/Search/Solr/Results.php index da51fe72db7..83ec53628a7 100644 --- a/module/Swissbib/src/Swissbib/VuFind/Search/Solr/Results.php +++ b/module/Swissbib/src/Swissbib/VuFind/Search/Solr/Results.php @@ -191,4 +191,68 @@ public function getTarget() { return $this->target; } + + /** + * PerformSearch + * + * @throws \Exception + * @throws \VuFindSearch\Backend\Exception\BackendException + * + * @return void + */ + protected function performSearch() + { + $query = $this->getParams()->getQuery(); + $limit = $this->getParams()->getLimit(); + $offset = $this->getStartRecord() - 1; + $params = $this->getParams()->getBackendParameters(); + $searchService = $this->getSearchService(); + + try { + $collection = $searchService + ->search($this->backendId, $query, $offset, $limit, $params); + } catch (\VuFindSearch\Backend\Exception\BackendException $e) { + // If the query caused a parser error, see if we can clean it up: + if ($e->hasTag('VuFind\Search\ParserError') + && $newQuery = $this->fixBadQuery($query) + ) { + // We need to get a fresh set of $params, since the previous one was + // manipulated by the previous search() call. + $params = $this->getParams()->getBackendParameters(); + $collection = $searchService + ->search($this->backendId, $newQuery, $offset, $limit, $params); + } else { + throw $e; + } + } + + //code aus letztem VuFind Core + $this->responseFacets = $collection->getFacets(); + $this->resultTotal = $collection->getTotal(); + + if ($this->resultTotal == 0) { + + //we use spellchecking only in case of 0 hits + + $params = $this->getParams()->getSpellcheckBackendParameters(); + try { + $recordCollectionSpellingQuery = $searchService + ->search($this->backendId, $query, $offset, $limit, $params); + } catch (\VuFindSearch\Backend\Exception\BackendException $e) { + //todo: some kind of logging? + throw $e; + } + // Process spelling suggestions + $spellcheck = $recordCollectionSpellingQuery->getSpellcheck(); + $this->spellingQuery = $spellcheck->getQuery(); + $this->suggestions = $this->getSpellingProcessor() + ->getSuggestions($spellcheck, $this->getParams()->getQuery()); + + + } + + // Construct record drivers for all the items in the response: + $this->results = $collection->getRecords(); + } + } From c30fa09ab0c4c93089287227894213924b9304c3 Mon Sep 17 00:00:00 2001 From: Lionel Walter Date: Mon, 1 Jul 2019 19:30:03 +0200 Subject: [PATCH 20/52] remove unused field --- .../Swissbib/src/Swissbib/VuFind/Search/Solr/Results.php | 7 ------- 1 file changed, 7 deletions(-) diff --git a/module/Swissbib/src/Swissbib/VuFind/Search/Solr/Results.php b/module/Swissbib/src/Swissbib/VuFind/Search/Solr/Results.php index 83ec53628a7..1dfea827d47 100644 --- a/module/Swissbib/src/Swissbib/VuFind/Search/Solr/Results.php +++ b/module/Swissbib/src/Swissbib/VuFind/Search/Solr/Results.php @@ -49,13 +49,6 @@ class Results extends VuFindSolrResults */ protected $target = 'swissbib'; - /** - * SpellingResults - * - * @var SpellingResults - */ - protected $sbSuggestions; - /** * Configuration for QueryFacets for swissbib MyLibraries * From fdeb9ba9e37fba93805ad8119c546fd74af9d7ef Mon Sep 17 00:00:00 2001 From: Lionel Walter Date: Tue, 2 Jul 2019 08:45:30 +0200 Subject: [PATCH 21/52] ready for merging --- .../baselbern/local/config/vufind/config.ini | 2 +- local/classic/test/config/vufind/config.ini | 8 ++++---- local/config/vufind/searchspecs.yaml | 20 ++++++++++++++++++- .../VuFindSearch/Backend/Solr/Connector.php | 4 ++-- 4 files changed, 26 insertions(+), 8 deletions(-) diff --git a/local/baselbern/local/config/vufind/config.ini b/local/baselbern/local/config/vufind/config.ini index c4f79077fbf..339017a3cd0 100644 --- a/local/baselbern/local/config/vufind/config.ini +++ b/local/baselbern/local/config/vufind/config.ini @@ -46,7 +46,7 @@ displayTestSystem = true ; This section needs to be changed to match your database connection information [Database] -@include = './../../../../private_config_values/private_config_baselbern_test_database.conf' ; url +@include = './../../../../private_config_values/private_config_baselbern_test_database.conf' ; database [SearchTabs] diff --git a/local/classic/test/config/vufind/config.ini b/local/classic/test/config/vufind/config.ini index 0bd2569650f..2fcc7ebd121 100644 --- a/local/classic/test/config/vufind/config.ini +++ b/local/classic/test/config/vufind/config.ini @@ -5,8 +5,8 @@ path = local/config/vufind/config_base.ini [Index] engine = Solr -;url = http://sb-up1.swissbib.unibas.ch/solr -url = http://localhost:8984/solr +url = http://sb-up1.swissbib.unibas.ch/solr +;url = http://localhost:8984/solr maxBooleanClauses = 1024 timeout = 30 ;default_core = suggestions @@ -14,8 +14,8 @@ timeout = 30 [Database] @include = './../../../../private_config_values/private_config_classic_test_database.conf' ; url -[ElasticSearch] -hosts[]=localhost:9201 +;[ElasticSearch] +;hosts[]=localhost:9201 [Authentication] hash_passwords = true diff --git a/local/config/vufind/searchspecs.yaml b/local/config/vufind/searchspecs.yaml index 99fd9114378..93733e90d83 100644 --- a/local/config/vufind/searchspecs.yaml +++ b/local/config/vufind/searchspecs.yaml @@ -20,7 +20,25 @@ AllFields: - author_additional_gnd_txt_mv^100 # variants from GND - title_additional_gnd_txt_mv^100 - publplace_additional_gnd_txt_mv^100 - # local codes (field 909) : should be removed after next full reindex. It will be replaced by localcode_txt_mv + - series^200 + - topic^500 # all verbal topics, i.e. 6xx + - related_gnd_txt_mv^500 # GND related terms 5xx + - addfields_txt_mv^50 # additional fields + - publplace_txt_mv^25 # publication country and place, i.e. 752ad + - publplace_dsv11_txt_mv^25 + - fulltext # imported fulltext, i.e. TOC/Abstracts + - callnumber_txt_mv^50 # callnumbers (works only when quoted) with low boost + - ctrlnum^1000 + - publishDate + - isbn + - cancisbn_isn_mv + - variant_isbn_isn_mv + - issn + - incoissn_isn_mv + - ismn_isn_mv + - doi_isn_mv + - urn_isn_mv + - localcode # local codes (field 909) : should be removed after next full reindex. It will be replaced by localcode_txt_mv - localcode_txt_mv # local codes splitted at spaces - id_txt DismaxParams: diff --git a/module/VuFindSearch/src/VuFindSearch/Backend/Solr/Connector.php b/module/VuFindSearch/src/VuFindSearch/Backend/Solr/Connector.php index a8405b81280..6f567a2af7d 100644 --- a/module/VuFindSearch/src/VuFindSearch/Backend/Solr/Connector.php +++ b/module/VuFindSearch/src/VuFindSearch/Backend/Solr/Connector.php @@ -450,12 +450,12 @@ protected function trySolrUrls($method, $urlSuffix, $callback = null) protected function send(HttpClient $client) { //useful to display links to solr queries directly on screen - + /* echo 'solr link'; - + */ $this->debug( sprintf('=> %s %s', $client->getMethod(), $client->getUri()) From f8d3805b392b652821749e42976fc13d43785bca Mon Sep 17 00:00:00 2001 From: Lionel Walter Date: Tue, 2 Jul 2019 08:47:18 +0200 Subject: [PATCH 22/52] refactor spellchecking, closer to core and better suggestions for multi words corrections, fixes #676 --- .../baselbern/local/config/vufind/config.ini | 2 +- module/Swissbib/config/module.config.php | 2 - .../View/Helper/RenderSuggestions.php | 107 ++++++++ .../VuFind/Search/Results/Factory.php | 5 +- .../Swissbib/VuFind/Search/Solr/Factory.php | 86 ------- .../Solr/InjectSwissbibSpellingListener.php | 89 +++---- .../Swissbib/VuFind/Search/Solr/Results.php | 51 +--- .../VuFind/Search/Solr/SpellingProcessor.php | 242 ------------------ .../VuFind/Search/Solr/SpellingResults.php | 203 --------------- .../Recommend/SpellingSuggestions.phtml | 28 ++ themes/sbvfrd/templates/search/results.phtml | 2 +- .../search/spellingSuggestions.phtml | 61 ----- themes/sbvfrd/theme.config.php | 2 + .../Recommend/SpellingSuggestions.phtml | 36 +++ .../search/spellingSuggestions.phtml | 99 ------- 15 files changed, 213 insertions(+), 802 deletions(-) create mode 100644 module/Swissbib/src/Swissbib/View/Helper/RenderSuggestions.php delete mode 100644 module/Swissbib/src/Swissbib/VuFind/Search/Solr/Factory.php delete mode 100644 module/Swissbib/src/Swissbib/VuFind/Search/Solr/SpellingProcessor.php delete mode 100644 module/Swissbib/src/Swissbib/VuFind/Search/Solr/SpellingResults.php create mode 100644 themes/sbvfrd/templates/Recommend/SpellingSuggestions.phtml delete mode 100644 themes/sbvfrd/templates/search/spellingSuggestions.phtml create mode 100644 themes/sbvfrdmulti/templates/Recommend/SpellingSuggestions.phtml delete mode 100644 themes/sbvfrdmulti/templates/search/spellingSuggestions.phtml diff --git a/local/baselbern/local/config/vufind/config.ini b/local/baselbern/local/config/vufind/config.ini index c4f79077fbf..339017a3cd0 100644 --- a/local/baselbern/local/config/vufind/config.ini +++ b/local/baselbern/local/config/vufind/config.ini @@ -46,7 +46,7 @@ displayTestSystem = true ; This section needs to be changed to match your database connection information [Database] -@include = './../../../../private_config_values/private_config_baselbern_test_database.conf' ; url +@include = './../../../../private_config_values/private_config_baselbern_test_database.conf' ; database [SearchTabs] diff --git a/module/Swissbib/config/module.config.php b/module/Swissbib/config/module.config.php index 7aede96c0dc..e178b85d04d 100644 --- a/module/Swissbib/config/module.config.php +++ b/module/Swissbib/config/module.config.php @@ -458,8 +458,6 @@ 'Swissbib\RecordDriver\SolrDefaultAdapter' => 'Swissbib\RecordDriver\Factory::getSolrDefaultAdapter', 'VuFind\Export' => 'Swissbib\Services\Factory::getExport', //no longer needed but test it more profoundly - 'sbSpellingProcessor' => 'Swissbib\VuFind\Search\Solr\Factory::getSpellchecker', - 'sbSpellingResults' => 'Swissbib\VuFind\Search\Solr\Factory::getSpellingResults', 'Swissbib\Hierarchy\SimpleTreeGenerator' => 'Swissbib\Hierarchy\Factory::getSimpleTreeGenerator', 'Swissbib\Hierarchy\MultiTreeGenerator' => 'Swissbib\Hierarchy\Factory::getMultiTreeGenerator', diff --git a/module/Swissbib/src/Swissbib/View/Helper/RenderSuggestions.php b/module/Swissbib/src/Swissbib/View/Helper/RenderSuggestions.php new file mode 100644 index 00000000000..a4d0c5a0501 --- /dev/null +++ b/module/Swissbib/src/Swissbib/View/Helper/RenderSuggestions.php @@ -0,0 +1,107 @@ + + * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License + * @link http://vufind.org/wiki/vufind2:developer_manual Wiki + */ +namespace Swissbib\View\Helper; + +use Swissbib\VuFind\Db\Row\NationalLicenceUser; +use VuFind\Search\UrlQueryHelper; +use VuFindSearch\Query\Query; +use Zend\View\Helper\AbstractHelper; + +/** + * Render suggestions + * + * @category Swissbib_VuFind + * @package View_Helper + * @author Lionel Walter + * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License + * @link http://vufind.org/wiki/vufind2:developer_manual Wiki + */ +class RenderSuggestions extends AbstractHelper +{ + /** + * Render suggestions + * + * @param \VuFind\Search\Base\Results $results Results object + * @param \Zend\View\Renderer\PhpRenderer $view View renderer object + * + * @return string + */ + public function __invoke($results, $view) + { + $spellingSuggestions = $results->getSpellingSuggestions(); + if (empty($spellingSuggestions)) { + return ''; + } + + $html = ''; + + $suggested = []; + foreach ($spellingSuggestions as $term => $details) { + foreach ($details['suggestions'] as $word => $data) { + $suggested[$term] = $word; + break;//only the first suggestion + } + } + + /** + * Initial Query + * + * @var Query $initialQuery + */ + $initialQuery = $results->getParams()->getQuery(); + + + foreach ($suggested as $term => $suggestion) { + $initialQuery->replaceTerm($term, $suggestion); + } + + $text = $initialQuery->getString(); + + /** + * Url Query Helper + * + * @var UrlQueryHelper $query + */ + $query = $results->getUrlQuery(); + + foreach ($suggested as $term => $suggestion) { + $query = $query->replaceTerm($term, $suggestion); + } + + + $href=$query->getParams(); + + + $html .= '' . $view->escapeHtml($text) + . ''; + + + return $html; + } +} diff --git a/module/Swissbib/src/Swissbib/VuFind/Search/Results/Factory.php b/module/Swissbib/src/Swissbib/VuFind/Search/Results/Factory.php index 7d78f2f3ad2..13f4d1f69d3 100644 --- a/module/Swissbib/src/Swissbib/VuFind/Search/Results/Factory.php +++ b/module/Swissbib/src/Swissbib/VuFind/Search/Results/Factory.php @@ -28,6 +28,7 @@ namespace Swissbib\VuFind\Search\Results; use Swissbib\VuFind\Search\Favorites\Results; +use VuFind\Search\Solr\SpellingProcessor; use Zend\ServiceManager\ServiceManager; /** @@ -59,9 +60,11 @@ public static function getSolr(ServiceManager $sm) */ $solr = $factory($sm, 'Solr'); + $config = $sm->get('VuFind\Config\PluginManager')->get('config'); $solr->setSpellingProcessor( - $sm->get("sbSpellingProcessor") + new SpellingProcessor($config->Spelling ?? null) ); + return $solr; } diff --git a/module/Swissbib/src/Swissbib/VuFind/Search/Solr/Factory.php b/module/Swissbib/src/Swissbib/VuFind/Search/Solr/Factory.php deleted file mode 100644 index 93f8c4a56a4..00000000000 --- a/module/Swissbib/src/Swissbib/VuFind/Search/Solr/Factory.php +++ /dev/null @@ -1,86 +0,0 @@ - - * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License - * @link http://www.swissbib.org Main Page - */ -namespace Swissbib\VuFind\Search\Solr; - -use Zend\Config\Config as ZendConfig; -use Zend\ServiceManager\ServiceManager; - -/** - * Factory to create specialized types in the Search/Solr namespace - * - * @category Swissbib_VuFind - * @package VuFind_Search_Solr - * @author Guenter Hipler - * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License - * @link http://www.vufind.org Main Page - */ -class Factory -{ - /** - * GetSpellchecker - * - * @param ServiceManager $sm ServiceManager - * - * @return SpellingProcessor - */ - public static function getSpellchecker(ServiceManager $sm) - { - $config = $sm - ->get('VuFind\Config\PluginManager')->get('config'); - /** - * SpellConfig - * - * @var $spellConfig ZendConfig - * todo: no unit test so far - what happens if we provide an empty configu - * should be better as null - */ - $spellConfig = isset($config->Spelling) - ? $config->Spelling : new ZendConfig([]); - - /** - * Spelling Results - * - * @var $spellingResults SpellingResults - */ - $spellingResults = $sm->get("sbSpellingResults"); - - return new SpellingProcessor($spellingResults, $spellConfig); - } - - /** - * GetSpellingResults - * - * @param ServiceManager $sm ServiceManagers - * - * @return SpellingResults - */ - public static function getSpellingResults(ServiceManager $sm) - { - return new SpellingResults(); - } -} diff --git a/module/Swissbib/src/Swissbib/VuFind/Search/Solr/InjectSwissbibSpellingListener.php b/module/Swissbib/src/Swissbib/VuFind/Search/Solr/InjectSwissbibSpellingListener.php index ad6331c4b26..139d8be70d4 100644 --- a/module/Swissbib/src/Swissbib/VuFind/Search/Solr/InjectSwissbibSpellingListener.php +++ b/module/Swissbib/src/Swissbib/VuFind/Search/Solr/InjectSwissbibSpellingListener.php @@ -1,41 +1,39 @@ - * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License - * @link http://www.swissbib.org - */ +/** + * InjectSwissbibSpellingListener + * + * PHP version 7 + * + * Copyright (C) project swissbib, University Library Basel, Switzerland + * http://www.swissbib.org / http://www.swissbib.ch / http://www.ub.unibas.ch + * + * Date: 9/19/13 + * Time: 8:33 PM + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2, + * as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * @category Swissbib_VuFind + * @package VuFind_Search_Solr + * @author Guenter Hipler + * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License + * @link http://www.swissbib.org + */ namespace Swissbib\VuFind\Search\Solr; - use VuFind\Search\Solr\InjectSpellingListener as VFSpellingListener; use VuFindSearch\Backend\Solr\Response\Json\Spellcheck; use VuFindSearch\ParamBag; use VuFindSearch\Query\Query; use Zend\EventManager\EventInterface; - /** * InjectSwissbibSpellingListener * @@ -63,7 +61,6 @@ public function onSearchPre(EventInterface $event) // Set spelling parameters unless explicitly disabled: $sc = $params->get('swissbibspellcheck'); if (!empty($sc) && $sc[0] != 'false') { - //remove the homegrown parameter only needed to activate // the spellchecker in case of zero hits $params->remove("swissbibspellcheck"); @@ -73,44 +70,18 @@ public function onSearchPre(EventInterface $event) 'Spellcheck requested but no dictionary configured' ); } - // Set relevant Solr parameters: reset($this->dictionaries); $params->set('spellcheck', 'true'); $params->set( 'spellcheck.dictionary', current($this->dictionaries) ); - // Turn on spellcheck.q generation in query builder: $this->backend->getQueryBuilder() ->setCreateSpellingQuery(true); } } } - return $event; } - - /** - * AggregateSpellcheck - * - * @param Spellcheck $spellcheck Spellcheck - * @param string $query Query - * - * @return void - */ - protected function aggregateSpellcheck(Spellcheck $spellcheck, $query) - { - foreach ($this->dictionaries as $dictionary) { - $params = new ParamBag(); - - $params->set('spellcheck', 'true'); - $params->set('spellcheck.dictionary', $dictionary); - - $queryObj = new Query($query, 'AllFields'); - $collection = $this->backend->search($queryObj, 0, 0, $params); - - $spellcheck->mergeWith($collection->getSpellcheck()); - } - } -} +} \ No newline at end of file diff --git a/module/Swissbib/src/Swissbib/VuFind/Search/Solr/Results.php b/module/Swissbib/src/Swissbib/VuFind/Search/Solr/Results.php index 107e40067c6..1dfea827d47 100644 --- a/module/Swissbib/src/Swissbib/VuFind/Search/Solr/Results.php +++ b/module/Swissbib/src/Swissbib/VuFind/Search/Solr/Results.php @@ -49,13 +49,6 @@ class Results extends VuFindSolrResults */ protected $target = 'swissbib'; - /** - * SpellingResults - * - * @var SpellingResults - */ - protected $sbSuggestions; - /** * Configuration for QueryFacets for swissbib MyLibraries * @@ -242,53 +235,17 @@ protected function performSearch() //todo: some kind of logging? throw $e; } - - // Processing of spelling suggestions + // Process spelling suggestions $spellcheck = $recordCollectionSpellingQuery->getSpellcheck(); $this->spellingQuery = $spellcheck->getQuery(); - - //GH: I introduced a special type for suggestions provided by the SOLR - // index in opposition to the VF2 core implementation where a simple - // array structure is used a specialized type makes it much easier to - // use the suggestions in the view script - //the object variable suggestions is already used by VF2 core - $this->sbSuggestions = $this->getSpellingProcessor() + $this->suggestions = $this->getSpellingProcessor() ->getSuggestions($spellcheck, $this->getParams()->getQuery()); - } - // Construct record drivers for all the items in the response: - $this->results = $collection->getRecords(); - } - /** - * GetSpellingProcessor - * - * @return mixed - */ - public function getSpellingProcessor() - { - if (null === $this->spellingProcessor) { - //$this->spellingProcessor = $this->getServiceLocator() - // ->get("sbSpellingProcessor"); - // - //only temporary, with VF4 we do not have ServiceLocator - //old Factory is creating the processor in this simple way - //todo !! - //but: we do have to analyze the new VF implementation - $this->spellingProcessor = new SpellingProcessor(new SpellingResults()); } - return $this->spellingProcessor; + // Construct record drivers for all the items in the response: + $this->results = $collection->getRecords(); } - /** - * Turn the list of spelling suggestions into an array of urls - * for on-screen use to implement the suggestions. - * - * @return array Spelling suggestion data arrays - */ - public function getSpellingSuggestions() - { - return $this->sbSuggestions; - } } diff --git a/module/Swissbib/src/Swissbib/VuFind/Search/Solr/SpellingProcessor.php b/module/Swissbib/src/Swissbib/VuFind/Search/Solr/SpellingProcessor.php deleted file mode 100644 index 11d00333e8c..00000000000 --- a/module/Swissbib/src/Swissbib/VuFind/Search/Solr/SpellingProcessor.php +++ /dev/null @@ -1,242 +0,0 @@ - - * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License - * @link http://www.swissbib.org Main Page - */ -namespace Swissbib\VuFind\Search\Solr; - -use VuFind\Search\Solr\SpellingProcessor as VFSpellingProcessor; -use VuFindSearch\Backend\Solr\Response\Json\Spellcheck; -use VuFindSearch\Query\AbstractQuery; -use Zend\Config\Config as ZendConfig; - -/** - * Extended version of the VuFind Solr Spelling Processor (based on - * advanced Spellers like DirectIndexSpelling and .... ) - * - * @category Swissbib_VuFind - * @package VuFind_Search_Solr - * @author Guenter Hipler - * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License - * @link http://www.vufind.org Main Page - */ -class SpellingProcessor extends VFSpellingProcessor -{ - /** - * SpellingResults - * - * @var SpellingResults - */ - protected $spellingResults; - - /** - * Spelling limit - * - * @var int - */ - protected $spellingLimit = 3; - - /** - * TermSpellingLimits - * - * @var int - */ - protected $termSpellingLimits = 3; - - /** - * Spell check words with numbers in them? - * - * @var bool - */ - protected $spellSkipNumeric = true; - - /** - * Offer expansions on terms as well as basic replacements? - * - * @var bool - */ - protected $expand = true; - - /** - * Show the full modified search phrase on screen rather then just the suggested - * word? - * - * @var bool - */ - protected $phrase = false; - - /** - * Constructor - * - * @param SpellingResults $spellingResults Spelling configuration (optional) - * @param ZendConfig $config configuration - * - * todo: so far no unit tests - by now - * todo: I simply extended the class - * todo: because I had a problem with - * todo: the setSpellingProcessor - * method in VuFind\Search\Solr\Results - */ - public function __construct(SpellingResults $spellingResults, ZendConfig $config) - { - parent::__construct($config); - $this->spellingResults = $spellingResults; - } - - /** - * Are we skipping numeric words? - * - * @return bool - */ - public function shouldSkipNumericSpelling() - { - return $this->spellSkipNumeric; - } - - /** - * Get the spelling limit. - * - * @return int - */ - public function getSpellingLimit() - { - return $this->spellingLimit; - } - - /** - * Input Tokenizer - Specifically for spelling purposes - * - * Because of its focus on spelling, these tokens are unsuitable - * for actual searching. They are stripping important search data - * such as joins and groups, simply because they don't need to be - * spellchecked. - * - * @param string $input Query to tokenize - * - * @return array Tokenized array - */ - public function tokenize($input) - { - //at the moment not used by swissbib (maybe the blacklist - not used terms - // like and / or / not .. but should be handled by the search engine - - return []; - } - - /** - * Get raw spelling suggestions for a query. - * - * @param Spellcheck $spellcheck Complete spellcheck information - * @param AbstractQuery $query Query for which info should be retrieved - * - * @return array - * @throws \Exception - */ - public function getSuggestions(Spellcheck $spellcheck, AbstractQuery $query) - { - if (!$this->spellingResults->hasSuggestions()) { - $this->spellingResults->setSpellingQuery($query); - $i = 1; - foreach ($spellcheck as $term => $info) { - if ($term == "collation") { - if (is_array($info)) { - $this->spellingResults->addCollocationSOLRStructure($info); - } - } elseif (++$i && $i <= $this->getSpellingLimit() - && array_key_exists("suggestion", $info) - ) { - //no so called collation suggestions are based on the - // single term part of the spelling query - $numberTermSuggestions = 1; - foreach ($info['suggestion'] as $termSuggestion) { - $numberTermSuggestions++; - if ($numberTermSuggestions > $this->termSpellingLimits) { - break; - } - $this->spellingResults->addTerm( - $term, $termSuggestion['word'], $termSuggestion['freq'] - ); - } - } - } - } - - return $this->spellingResults; - } - - /** - * Support method for getSuggestions() - * - * @param AbstractQuery $query Query for which info should be retrieved - * @param array $info Spelling suggestion information - * - * @return array - * @throws \Exception - */ - protected function formatAndFilterSuggestions($query, $info) - { - // Validate response format - if (isset($info['suggestion'][0]) && !is_array($info['suggestion'][0])) { - throw new \Exception( - 'Unexpected suggestion format; spellcheck.extendedResults' - . ' must be set to true.' - ); - } - $limit = $this->getSpellingLimit(); - $suggestions = []; - foreach ($info['suggestion'] as $suggestion) { - if (count($suggestions) >= $limit) { - break; - } - $word = $suggestion['word']; - if (!$this->shouldSkipTerm($query, $word, true)) { - $suggestions[$word] = $suggestion['freq']; - } - } - return $suggestions; - } - - /** - * Should we skip the specified term? - * - * @param AbstractQuery $query Query for which info should be retrieved - * @param string $term Term to check - * @param bool $queryContains Should we skip the term if it is found - * in the query (true), or should we skip the - * term if it is NOT found in the - * query (false)? - * - * @return bool - */ - protected function shouldSkipTerm($query, $term, $queryContains) - { - // If term is numeric and we're in "skip numeric" mode, we should skip it: - if ($this->shouldSkipNumericSpelling() && is_numeric($term)) { - return true; - } - // We should also skip terms already contained within the query: - return $queryContains == $query->containsTerm($term); - } -} diff --git a/module/Swissbib/src/Swissbib/VuFind/Search/Solr/SpellingResults.php b/module/Swissbib/src/Swissbib/VuFind/Search/Solr/SpellingResults.php deleted file mode 100644 index 8a67c8ead16..00000000000 --- a/module/Swissbib/src/Swissbib/VuFind/Search/Solr/SpellingResults.php +++ /dev/null @@ -1,203 +0,0 @@ - - * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License - * @link http://www.swissbib.org Main Page - */ -namespace Swissbib\VuFind\Search\Solr; - -use VuFindSearch\Query\AbstractQuery; - -/** - * Spelling results is the container type to collect spelling suggestions provided - * by the SOLR SearchEngine - * Actually we distinguish collocation suggestions (multiple terms in sequence or - * simple single term suggestions - * term suggestions are variants of a token part of the original query - * - * @category Swissbib_VuFind - * @package VuFind_Search_Solr - * @author Guenter Hipler - * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License - * @link http://www.swissbib.org Main Page - */ -class SpellingResults -{ - /** - * Holds the collocation values and number of documents - * - * @var array - */ - protected $collocations = []; - - /** - * Holds the suggested term values related to their key with number - * of documents to be expected - * - * @var array - */ - protected $terms = []; - - /** - * SpellingQuery - * - * @var AbstractQuery - */ - protected $spellingQuery; - - /** - * AddCollocation - * method expects collocation and frequency explicitly - * (processing has to be done by the client) - * - * @param String $collocation Collocation - * @param String $frequency Frequency - * - * @return void - */ - public function addCollocation($collocation, $frequency) - { - $this->collocations[] = [$collocation, $frequency]; - } - - /** - * AddCollocationSOLRStructure - * - * @param array $solrInfoStructure SolrInfoStructure - * - * @return void - */ - public function addCollocationSOLRStructure(array $solrInfoStructure) - { - $collationSuggestion = []; - //if term indicates a collation the info variable (again an array) - // consists of three parts - //[0][0] => "collationQuery" string as key - //[0][1] => the collation query provided by SOLR istself - //[1][0] => "hits" string as key - //[1][1] => number of hits for the collation query suggested by SOLR - //[2][..] => a list of so called "misspellingAndCorrections" for each - // of the tokens part of the collation query - //I don't use this at the moment - foreach ($solrInfoStructure as $infoValues) { - if ($infoValues[0] == "collationQuery") { - $collationSuggestion["query"] = $infoValues[1]; - } elseif ($infoValues[0] == "hits") { - $collationSuggestion["hits"] = $infoValues[1]; - } - } - - if (array_key_exists("query", $collationSuggestion) - && array_key_exists("hits", $collationSuggestion) - ) { - $this->collocations[] = $collationSuggestion; - } - } - - /** - * AddTerm - * - * @param String $key Key - * @param String $value Value - * @param String $frequency Frequency - * - * @return void - */ - public function addTerm($key, $value, $frequency) - { - $this->terms[$key][] = ['query' => $value, 'hits' => $frequency]; - } - - /** - * HasSuggestions - * - * @return bool - */ - public function hasSuggestions() - { - return count($this->collocations) > 0 || count($this->terms) > 0; - } - - /** - * HasCollocations - * - * @return bool - */ - public function hasCollocations() - { - return count($this->collocations) > 0; - } - - /** - * HasTerms - * - * @return bool - */ - public function hasTerms() - { - return count($this->terms) > 0; - } - - /** - * SetSpellingQuery - * - * @param AbstractQuery $query Query - * - * @return void - */ - public function setSpellingQuery(AbstractQuery $query) - { - $this->spellingQuery = $query; - } - - /** - * GetSpellingQuery - * - * @return AbstractQuery - */ - public function getSpellingQuery() - { - return $this->spellingQuery; - } - - /** - * GetCollocationSuggestions - * - * @return array - */ - public function getCollocationSuggestions() - { - return $this->collocations; - } - - /** - * GetTermSuggestions - * - * @return array - */ - public function getTermSuggestions() - { - return $this->terms; - } -} diff --git a/themes/sbvfrd/templates/Recommend/SpellingSuggestions.phtml b/themes/sbvfrd/templates/Recommend/SpellingSuggestions.phtml new file mode 100644 index 00000000000..2ac1ecb1e9b --- /dev/null +++ b/themes/sbvfrd/templates/Recommend/SpellingSuggestions.phtml @@ -0,0 +1,28 @@ +results; +$suggestions = $this->renderSuggestions($results, $this); +?> + + + +
+
+

transEsc('nohit_heading')?>

+
+
+ +
+

transEsc('nohit_spelling') ?>

+

+
+ +
+

transEsc('nohit_suggest') ?>

+

transEsc('nohit_text3') ?>transEsc('worldcat') ?>

+
+
+

transEsc('nohit_tip') ?>

+

transEsc('Search Tips') ?>

+

transEsc('Advanced Search')?> transEsc('nohit_text5') ?>

+
+ diff --git a/themes/sbvfrd/templates/search/results.phtml b/themes/sbvfrd/templates/search/results.phtml index 44df840e105..22585eb7641 100644 --- a/themes/sbvfrd/templates/search/results.phtml +++ b/themes/sbvfrd/templates/search/results.phtml @@ -94,7 +94,7 @@ - render('search/spellingSuggestions.phtml')?> + render('Recommend/SpellingSuggestions.phtml')?> 0): // only display these at very top if we have results ?> results->getRecommendations('top') as $current): ?> diff --git a/themes/sbvfrd/templates/search/spellingSuggestions.phtml b/themes/sbvfrd/templates/search/spellingSuggestions.phtml deleted file mode 100644 index e3e5cb23eab..00000000000 --- a/themes/sbvfrd/templates/search/spellingSuggestions.phtml +++ /dev/null @@ -1,61 +0,0 @@ -results->getSpellingSuggestions(); -$query = $this->results->getUrlQuery(); -?> - - -
-
-

transEsc('nohit_heading')?>

-
-
- - -hasSuggestions()) : ?> - -
-

transEsc('Your search terms')?>: escapeHtml($suggestions->getSpellingQuery()->getAllTerms()) ?>

-
- -
-

transEsc('nohit_spelling') ?>

- getSpellingQuery()->getString() ?> - - hasCollocations()) :?> - - getCollocationSuggestions() as $collocation) :?> -

escapeHtml($collocation['query']) ?>

- - - - hasTerms()) :?> - - getTermSuggestions() as $key => $termValues) :?> - - -

escapeHtml($termValue['query']) ?>

- - - - -
- - - - - - -
-

transEsc('nohit_suggest') ?>

-

transEsc('nohit_text3') ?>transEsc('worldcat') ?>

-
-
-

transEsc('nohit_tip') ?>

-

transEsc('Search Tips') ?>

-

transEsc('Advanced Search')?> transEsc('nohit_text5') ?>

-
- - - - diff --git a/themes/sbvfrd/theme.config.php b/themes/sbvfrd/theme.config.php index d6a4a1dfe00..86a25ddb8ec 100644 --- a/themes/sbvfrd/theme.config.php +++ b/themes/sbvfrd/theme.config.php @@ -50,6 +50,7 @@ 'translateFacets' => 'Swissbib\View\Helper\Swissbib\Factory::getFacetTranslator', 'formatRelatedEntries' => 'Swissbib\View\Helper\Swissbib\Factory::getFormatRelatedEntries', \Swissbib\VuFind\View\Helper\Root\Translate::class => 'Zend\ServiceManager\Factory\InvokableFactory', + 'Swissbib\View\Helper\RenderSuggestions' => 'Zend\ServiceManager\Factory\InvokableFactory', ], 'aliases' => [ 'auth' => 'VuFind\View\Helper\Root\Auth', @@ -59,6 +60,7 @@ 'recordLink' => 'Swissbib\View\Helper\RecordLink', 'searchtabs' => 'Swissbib\VuFind\View\Helper\Root\SearchTabs', 'translate' => \Swissbib\VuFind\View\Helper\Root\Translate::class, + 'renderSuggestions' => 'Swissbib\View\Helper\RenderSuggestions', ], ] ]; diff --git a/themes/sbvfrdmulti/templates/Recommend/SpellingSuggestions.phtml b/themes/sbvfrdmulti/templates/Recommend/SpellingSuggestions.phtml new file mode 100644 index 00000000000..91cd2af0492 --- /dev/null +++ b/themes/sbvfrdmulti/templates/Recommend/SpellingSuggestions.phtml @@ -0,0 +1,36 @@ +results; +$suggestions = $this->renderSuggestions($results, $this); +?> + + + +
+
+

transEsc('nohit_heading')?>

+
+
+ +
+

transEsc('nohit_spelling') ?>

+

+
+ +
+

transEsc('nohit_suggest') ?>

+ transEsc('nohit_text1') ?> + transEsc('nohit_text2') ?> + +

transEsc('nohit_text3') ?>transEsc('tab.summon') ?>

+ +

transEsc('nohit_text3') ?>transEsc('swissbib') ?>

+

transEsc('nohit_text3') ?>transEsc('worldcat') ?>

+
+ +
+

transEsc('nohit_tip') ?>

+

transEsc('Search Tips')?>

+

transEsc('helppage.faq')?>

+

transEsc('Advanced Search')?> transEsc('nohit_text5') ?>

+
+ \ No newline at end of file diff --git a/themes/sbvfrdmulti/templates/search/spellingSuggestions.phtml b/themes/sbvfrdmulti/templates/search/spellingSuggestions.phtml deleted file mode 100644 index 93802a6aef8..00000000000 --- a/themes/sbvfrdmulti/templates/search/spellingSuggestions.phtml +++ /dev/null @@ -1,99 +0,0 @@ -results->getSpellingSuggestions(); -$query = $this->results->getUrlQuery(); -?> - - -
-
-

transEsc('nohit_heading')?>

-
-
- - - -hasSuggestions()) : ?> - -
-

transEsc('Your search terms')?>: getSpellingQuery()->getAllTerms() ?>

-
- -
-

transEsc('nohit_spelling') ?>

- getSpellingQuery()->getAllTerms() ?> - - hasCollocations()) :?> - - getCollocationSuggestions() as $collocation) :?> -

escapeHtml($collocation['query']) ?>

- - - - hasTerms()) :?> - - getTermSuggestions() as $key => $termValues) :?> - - -

escapeHtml($termValue['query']) ?>

- - - - -
- - - - - - - $details): - ?> - - -
-

transEsc('Your search terms')?>: escapeHtml($term) ?>

-
- -
-

transEsc('nohit_spelling') ?>

- - $data) : ?> - -

escapeHtml($data['new_term']) ?>

- - - -
- - - - - - - - -
-

transEsc('nohit_suggest') ?>

- transEsc('nohit_text1') ?> - transEsc('nohit_text2') ?> - -

transEsc('nohit_text3') ?>transEsc('tab.summon') ?>

- -

transEsc('nohit_text3') ?>transEsc('swissbib') ?>

-

transEsc('nohit_text3') ?>transEsc('worldcat') ?>

-
- -
-

transEsc('nohit_tip') ?>

-

transEsc('Search Tips')?>

-

transEsc('helppage.faq')?>

-

transEsc('Advanced Search')?> transEsc('nohit_text5') ?>

-
- - - - From 0c8e7c93b94e685f0714399b1062305fb5872da7 Mon Sep 17 00:00:00 2001 From: Lionel Walter Date: Tue, 2 Jul 2019 09:05:01 +0200 Subject: [PATCH 23/52] remove QueryFields section from searchspecs, where DismaxHandler is edismax --- local/config/vufind/searchspecs.yaml | 142 -------------------- local/config/vufind/searchspecs_jusbib.yaml | 125 +---------------- 2 files changed, 1 insertion(+), 266 deletions(-) diff --git a/local/config/vufind/searchspecs.yaml b/local/config/vufind/searchspecs.yaml index 93733e90d83..9a716fc9c8e 100644 --- a/local/config/vufind/searchspecs.yaml +++ b/local/config/vufind/searchspecs.yaml @@ -46,67 +46,6 @@ AllFields: - [ps, '2'] - [bf, 'recip(abs(ms(NOW/DAY,freshness)),3.16e-10,100,100)'] - -# DismaxParams: -# boost param as in old solrconfig.xml - QueryFields: - 0: - 0: - - OR - - 50 - title_short: - - [onephrase, 1000] - title_alt: - - [onephrase, 600] - - [and, 500] - title_additional_dsv11_txt_mv: - - [onephrase, 600] - - [and, 500] - title_additional_gnd_txt_mv: - - [onephrase, 600] - - [and, 500] - title_sub: - - [onephrase, 400] - title_old: - - [onephrase, 300] - - [and, 250] - title_new: - - [and, 200] - title: - - [onephrase, 100] - author: - - [and, 750] - author_additional: - - [and, 100] - author_additional_dsv11_txt_mv: - - [and, 100] - author_additional_gnd_txt_mv: - - [and, 100] - series: - - [and, 50] - topic: - - [onephrase, 300] - - [and, 250] - related_gnd_txt_mv: - - [onephrase, 300] - - [and, 250] - addfields_txt_mv: - - [onephrase, 150] - - [and, 125] - publplace_txt_mv: - - [onephrase, 150] - - [and, 125] - publplace_dsv11_txt_mv: - - [onephrase, 150] - - [and, 125] - publplace_gnd_txt_mv: - - [onephrase, 150] - - [and, 125] - fulltext: - - [or, ~] - localcode: - - [and, ~] - Author: DismaxHandler: edismax DismaxFields: @@ -114,23 +53,6 @@ Author: - author_additional^20 - author_additional_dsv11_txt_mv^20 - author_additional_gnd_txt_mv^20 - QueryFields: - author: - - [onephrase, 350] - - [and, 200] - - [or, 100] - author_additional: - - [onephrase, 50] - - [and, 50] - - [or, 20] - author_additional_dsv11_txt_mv: - - [onephrase, 50] - - [and, 50] - - [or, 20] - author_additional_gnd_txt_mv: - - [onephrase, 50] - - [and, 50] - - [or, 20] DismaxParams: - [mm, '100%'] @@ -146,31 +68,6 @@ ISN: - ismn_isn_mv - doi_isn_mv - urn_isn_mv - QueryFields: - issn: - - [and, 100] - - [or, ~] - incoissn_isn_mv: - - [and, 100] - - [or, ~] - isbn: - - [and, 100] - - [or, ~] - variant_isbn_isn_mv: - - [and, 100] - - [or, ~] - cancisbn_isn_mv: - - [and, 100] - - [or, ~] - ismn_isn_mv: - - [and, 100] - - [or, ~] - doi_isn_mv: - - [and, 100] - - [or, ~] - urn_isn_mv: - - [and, 100] - - [or, ~] DismaxParams: - [mm, '100%'] @@ -180,11 +77,6 @@ Subject: DismaxFields: - topic^150 - related_gnd_txt_mv - QueryFields: - topic: - - [onephrase, 350] - related_gnd_txt_mv: - - [or, ~] DismaxParams: - [bf, 'recip(abs(ms(NOW/DAY,freshness)),3.16e-10,100,100)'] - [mm, '100%'] @@ -272,30 +164,6 @@ Title: - series^100 - series2 - series^200 - QueryFields: - title_short: - - [onephrase, 500] - title_alt: - - [onephrase, 450] - - [and, 400] - title_additional_dsv11_txt_mv: - - [onephrase, 450] - - [and, 400] - title_additional_gnd_txt_mv: - - [onephrase, 450] - - [and, 400] - title_sub: - - [onephrase, 400] - title_old: - - [onephrase, 300] - - [and, 250] - title_alt: - - [and, 200] - title_new: - - [and, 100] - series: - - [onephrase, 100] - - [and, 50] DismaxParams: - [bf, 'recip(abs(ms(NOW/DAY,freshness)),3.16e-10,100,100)'] - [mm, '100%'] @@ -304,11 +172,6 @@ Series: DismaxHandler: edismax DismaxFields: - series^100 - QueryFields: - series: - - [onephrase, 500] - - [and, 200] - - [or, 100] DismaxParams: - [bf, 'recip(abs(ms(NOW/DAY,freshness)),3.16e-10,100,100)'] - [mm, '100%'] @@ -837,10 +700,5 @@ AuthorSuggest: DismaxHandler: edismax DismaxFields: - author - QueryFields: - author: - - [onephrase, 350] - - [and, 200] - - [or, 100] DismaxParams: - [mm, '100%'] diff --git a/local/config/vufind/searchspecs_jusbib.yaml b/local/config/vufind/searchspecs_jusbib.yaml index 50a600c1f32..df48e9e8fa2 100644 --- a/local/config/vufind/searchspecs_jusbib.yaml +++ b/local/config/vufind/searchspecs_jusbib.yaml @@ -41,62 +41,6 @@ AllFields: - [ps, '2'] - [bf, 'recip(abs(ms(NOW/DAY,freshness)),3.16e-10,100,100)'] -# DismaxParams: -# boost param as in old solrconfig.xml - QueryFields: - 0: - 0: - - OR - - 50 - title_short: - - [onephrase, 1000] - title_alt: - - [onephrase, 600] - - [and, 500] - title_additional_dsv11_txt_mv: - - [onephrase, 600] - - [and, 500] - title_additional_gnd_txt_mv: - - [onephrase, 600] - - [and, 500] - title_sub: - - [onephrase, 400] - title_old: - - [onephrase, 300] - - [and, 250] - title_new: - - [and, 200] - title: - - [onephrase, 100] - author: - - [and, 750] - author_additional: - - [and, 100] - author_additional_dsv11_txt_mv: - - [and, 100] - author_additional_gnd_txt_mv: - - [and, 100] - series: - - [and, 50] - topic: - - [onephrase, 300] - - [and, 250] - addfields_txt_mv: - - [onephrase, 150] - - [and, 125] - publplace_txt_mv: - - [onephrase, 150] - - [and, 125] - publplace_dsv11_txt_mv: - - [onephrase, 150] - - [and, 125] - publplace_gnd_txt_mv: - - [onephrase, 150] - - [and, 125] - fulltext: - - [or, ~] - localcode: - - [and, ~] FilterQuery: 'institution:Z16 OR institution:A208 OR institution:A196 OR institution:B463 OR institution:B464 OR institution:B465 OR institution:B466 OR union:RE71 OR itemid_isn_mv:HSG_P* OR itemid_isn_mv:HSG_AL_220* OR itemid_isn_mv:HSG_AL_221* OR itemid_isn_mv:HSG_AL_222* OR itemid_isn_mv:HSG_AL_304* OR itemid_isn_mv:HSG_AL_414* OR itemid_isn_mv:HSG_AL_875* OR itemid_isn_mv:HSG_AN_701* OR itemid_isn_mv:HSG_MB_3300* OR itemid_isn_mv:HSG_MD_4* OR itemid_isn_mv:HSG_ME_2* OR itemid_isn_mv:HSG_ME_3* OR itemid_isn_mv:HSG_ME_4* OR itemid_isn_mv:HSG_ME_8* OR itemid_isn_mv:HSG_MF_43* OR itemid_isn_mv:HSG_MF_7050 OR itemid_isn_mv:HSG_MF_8* OR itemid_isn_mv:HSG_MK_16* OR itemid_isn_mv:HSG_MK_17* OR itemid_isn_mv:HSG_MK_38* OR itemid_isn_mv:HSG_MK_7* OR itemid_isn_mv:HSG_QD_030 OR itemid_isn_mv:HSG_QD_050 OR itemid_isn_mv:HSG_QP_44* OR itemid_isn_mv:HSG_QP_45* OR itemid_isn_mv:HSG_QP_82* OR itemid_isn_mv:HSG_Jus* OR itemid_isn_mv:HSG_GHug* OR itemid_isn_mv:LUUHL_P* OR itemid_isn_mv:BIG_BIG_EPZB* OR itemid_isn_mv:BIG_BIG_Fus_B* OR classif_ddc:34* OR classif_ddc:364* OR classif_ddc:365* OR classif_udc:34* OR classif_udc:04* OR classif_rvk:P* OR classif_rero:s1dr OR classif_rero:s2dr OR classif_912:re OR classif_912:rw OR classif_912:rs OR classif_912:dr OR classif_912:/8[0-9]0/ OR classif_912:ZB34* OR classif_912:M11* OR classif_912:M12* OR classif_912:M91 OR sublocal:340 OR navDrsys:/[1-9]/ OR navDrsys:/[1-9][0-9]/ OR navDrsys:/[1-9]\.[1-9]/ OR navDrsys:/[1-9]\.[1-9][0-9]/ OR navDrsys:/[1-9][0-9]\.[1-9]/ OR navDrsys:/[1-9][0-9]\.[1-9][0-9]/ OR navDrsys:/D [1-9]/ OR navDrsys:/D [1-9][0-9]/ OR navDrsys:/D [1-9]\.[1-9]/ OR navDrsys:/D [1-9]\.[1-9][0-9]/ OR navDrsys:/D [1-9][0-9]\.[1-9]/ OR navDrsys:/D [1-9][0-9]\.[1-9][0-9]/ OR navDrsys:/F [1-9]/ OR navDrsys:/F [1-9][0-9]/ OR navDrsys:/F [1-9]\.[1-9]/ OR navDrsys:/F [1-9]\.[1-9][0-9]/ OR navDrsys:/F [1-9][0-9]\.[1-9]/ OR navDrsys:/F [1-9][0-9]\.[1-9][0-9]/' Author: @@ -106,29 +50,13 @@ Author: - author_additional^20 - author_additional_dsv11_txt_mv^20 - author_additional_gnd_txt_mv^20 - QueryFields: - author: - - [onephrase, 350] - - [and, 200] - - [or, 100] - author_additional: - - [onephrase, 50] - - [and, 50] - - [or, 20] - author_additional_dsv11_txt_mv: - - [onephrase, 50] - - [and, 50] - - [or, 20] - author_additional_gnd_txt_mv: - - [onephrase, 50] - - [and, 50] - - [or, 20] FilterQuery: 'institution:Z16 OR institution:A208 OR institution:A196 OR institution:B463 OR institution:B464 OR institution:B465 OR institution:B466 OR union:RE71 OR itemid_isn_mv:HSG_P* OR itemid_isn_mv:HSG_AL_220* OR itemid_isn_mv:HSG_AL_221* OR itemid_isn_mv:HSG_AL_222* OR itemid_isn_mv:HSG_AL_304* OR itemid_isn_mv:HSG_AL_414* OR itemid_isn_mv:HSG_AL_875* OR itemid_isn_mv:HSG_AN_701* OR itemid_isn_mv:HSG_MB_3300* OR itemid_isn_mv:HSG_MD_4* OR itemid_isn_mv:HSG_ME_2* OR itemid_isn_mv:HSG_ME_3* OR itemid_isn_mv:HSG_ME_4* OR itemid_isn_mv:HSG_ME_8* OR itemid_isn_mv:HSG_MF_43* OR itemid_isn_mv:HSG_MF_7050 OR itemid_isn_mv:HSG_MF_8* OR itemid_isn_mv:HSG_MK_16* OR itemid_isn_mv:HSG_MK_17* OR itemid_isn_mv:HSG_MK_38* OR itemid_isn_mv:HSG_MK_7* OR itemid_isn_mv:HSG_QD_030 OR itemid_isn_mv:HSG_QD_050 OR itemid_isn_mv:HSG_QP_44* OR itemid_isn_mv:HSG_QP_45* OR itemid_isn_mv:HSG_QP_82* OR itemid_isn_mv:HSG_Jus* OR itemid_isn_mv:HSG_GHug* OR itemid_isn_mv:LUUHL_P* OR itemid_isn_mv:BIG_BIG_EPZB* OR itemid_isn_mv:BIG_BIG_Fus_B* OR classif_ddc:34* OR classif_ddc:364* OR classif_ddc:365* OR classif_udc:34* OR classif_udc:04* OR classif_rvk:P* OR classif_rero:s1dr OR classif_rero:s2dr OR classif_912:re OR classif_912:rw OR classif_912:rs OR classif_912:dr OR classif_912:/8[0-9]0/ OR classif_912:ZB34* OR classif_912:M11* OR classif_912:M12* OR classif_912:M91 OR sublocal:340 OR navDrsys:/[1-9]/ OR navDrsys:/[1-9][0-9]/ OR navDrsys:/[1-9]\.[1-9]/ OR navDrsys:/[1-9]\.[1-9][0-9]/ OR navDrsys:/[1-9][0-9]\.[1-9]/ OR navDrsys:/[1-9][0-9]\.[1-9][0-9]/ OR navDrsys:/D [1-9]/ OR navDrsys:/D [1-9][0-9]/ OR navDrsys:/D [1-9]\.[1-9]/ OR navDrsys:/D [1-9]\.[1-9][0-9]/ OR navDrsys:/D [1-9][0-9]\.[1-9]/ OR navDrsys:/D [1-9][0-9]\.[1-9][0-9]/ OR navDrsys:/F [1-9]/ OR navDrsys:/F [1-9][0-9]/ OR navDrsys:/F [1-9]\.[1-9]/ OR navDrsys:/F [1-9]\.[1-9][0-9]/ OR navDrsys:/F [1-9][0-9]\.[1-9]/ OR navDrsys:/F [1-9][0-9]\.[1-9][0-9]/' DismaxParams: - [mm, '100%'] ISN: + DismaxHandler: edismax DismaxFields: - isbn - variant_isbn_isn_mv @@ -136,25 +64,6 @@ ISN: - ismn_isn_mv - doi_isn_mv - urn_isn_mv - QueryFields: - issn: - - [and, 100] - - [or, ~] - isbn: - - [and, 100] - - [or, ~] - variant_isbn_isn_mv: - - [and, 100] - - [or, ~] - ismn_isn_mv: - - [and, 100] - - [or, ~] - doi_isn_mv: - - [and, 100] - - [or, ~] - urn_isn_mv: - - [and, 100] - - [or, ~] FilterQuery: 'institution:Z16 OR institution:A208 OR institution:A196 OR institution:B463 OR institution:B464 OR institution:B465 OR institution:B466 OR union:RE71 OR itemid_isn_mv:HSG_P* OR itemid_isn_mv:HSG_AL_220* OR itemid_isn_mv:HSG_AL_221* OR itemid_isn_mv:HSG_AL_222* OR itemid_isn_mv:HSG_AL_304* OR itemid_isn_mv:HSG_AL_414* OR itemid_isn_mv:HSG_AL_875* OR itemid_isn_mv:HSG_AN_701* OR itemid_isn_mv:HSG_MB_3300* OR itemid_isn_mv:HSG_MD_4* OR itemid_isn_mv:HSG_ME_2* OR itemid_isn_mv:HSG_ME_3* OR itemid_isn_mv:HSG_ME_4* OR itemid_isn_mv:HSG_ME_8* OR itemid_isn_mv:HSG_MF_43* OR itemid_isn_mv:HSG_MF_7050 OR itemid_isn_mv:HSG_MF_8* OR itemid_isn_mv:HSG_MK_16* OR itemid_isn_mv:HSG_MK_17* OR itemid_isn_mv:HSG_MK_38* OR itemid_isn_mv:HSG_MK_7* OR itemid_isn_mv:HSG_QD_030 OR itemid_isn_mv:HSG_QD_050 OR itemid_isn_mv:HSG_QP_44* OR itemid_isn_mv:HSG_QP_45* OR itemid_isn_mv:HSG_QP_82* OR itemid_isn_mv:HSG_Jus* OR itemid_isn_mv:HSG_GHug* OR itemid_isn_mv:LUUHL_P* OR itemid_isn_mv:BIG_BIG_EPZB* OR itemid_isn_mv:BIG_BIG_Fus_B* OR classif_ddc:34* OR classif_ddc:364* OR classif_ddc:365* OR classif_udc:34* OR classif_udc:04* OR classif_rvk:P* OR classif_rero:s1dr OR classif_rero:s2dr OR classif_912:re OR classif_912:rw OR classif_912:rs OR classif_912:dr OR classif_912:/8[0-9]0/ OR classif_912:ZB34* OR classif_912:M11* OR classif_912:M12* OR classif_912:M91 OR sublocal:340 OR navDrsys:/[1-9]/ OR navDrsys:/[1-9][0-9]/ OR navDrsys:/[1-9]\.[1-9]/ OR navDrsys:/[1-9]\.[1-9][0-9]/ OR navDrsys:/[1-9][0-9]\.[1-9]/ OR navDrsys:/[1-9][0-9]\.[1-9][0-9]/ OR navDrsys:/D [1-9]/ OR navDrsys:/D [1-9][0-9]/ OR navDrsys:/D [1-9]\.[1-9]/ OR navDrsys:/D [1-9]\.[1-9][0-9]/ OR navDrsys:/D [1-9][0-9]\.[1-9]/ OR navDrsys:/D [1-9][0-9]\.[1-9][0-9]/ OR navDrsys:/F [1-9]/ OR navDrsys:/F [1-9][0-9]/ OR navDrsys:/F [1-9]\.[1-9]/ OR navDrsys:/F [1-9]\.[1-9][0-9]/ OR navDrsys:/F [1-9][0-9]\.[1-9]/ OR navDrsys:/F [1-9][0-9]\.[1-9][0-9]/' DismaxParams: - [mm, '100%'] @@ -164,9 +73,6 @@ Subject: DismaxHandler: edismax DismaxFields: - topic^150 - QueryFields: - topic: - - [onephrase, 350] FilterQuery: 'institution:Z16 OR institution:A208 OR institution:A196 OR institution:B463 OR institution:B464 OR institution:B465 OR institution:B466 OR union:RE71 OR itemid_isn_mv:HSG_P* OR itemid_isn_mv:HSG_AL_220* OR itemid_isn_mv:HSG_AL_221* OR itemid_isn_mv:HSG_AL_222* OR itemid_isn_mv:HSG_AL_304* OR itemid_isn_mv:HSG_AL_414* OR itemid_isn_mv:HSG_AL_875* OR itemid_isn_mv:HSG_AN_701* OR itemid_isn_mv:HSG_MB_3300* OR itemid_isn_mv:HSG_MD_4* OR itemid_isn_mv:HSG_ME_2* OR itemid_isn_mv:HSG_ME_3* OR itemid_isn_mv:HSG_ME_4* OR itemid_isn_mv:HSG_ME_8* OR itemid_isn_mv:HSG_MF_43* OR itemid_isn_mv:HSG_MF_7050 OR itemid_isn_mv:HSG_MF_8* OR itemid_isn_mv:HSG_MK_16* OR itemid_isn_mv:HSG_MK_17* OR itemid_isn_mv:HSG_MK_38* OR itemid_isn_mv:HSG_MK_7* OR itemid_isn_mv:HSG_QD_030 OR itemid_isn_mv:HSG_QD_050 OR itemid_isn_mv:HSG_QP_44* OR itemid_isn_mv:HSG_QP_45* OR itemid_isn_mv:HSG_QP_82* OR itemid_isn_mv:HSG_Jus* OR itemid_isn_mv:HSG_GHug* OR itemid_isn_mv:LUUHL_P* OR itemid_isn_mv:BIG_BIG_EPZB* OR itemid_isn_mv:BIG_BIG_Fus_B* OR classif_ddc:34* OR classif_ddc:364* OR classif_ddc:365* OR classif_udc:34* OR classif_udc:04* OR classif_rvk:P* OR classif_rero:s1dr OR classif_rero:s2dr OR classif_912:re OR classif_912:rw OR classif_912:rs OR classif_912:dr OR classif_912:/8[0-9]0/ OR classif_912:ZB34* OR classif_912:M11* OR classif_912:M12* OR classif_912:M91 OR sublocal:340 OR navDrsys:/[1-9]/ OR navDrsys:/[1-9][0-9]/ OR navDrsys:/[1-9]\.[1-9]/ OR navDrsys:/[1-9]\.[1-9][0-9]/ OR navDrsys:/[1-9][0-9]\.[1-9]/ OR navDrsys:/[1-9][0-9]\.[1-9][0-9]/ OR navDrsys:/D [1-9]/ OR navDrsys:/D [1-9][0-9]/ OR navDrsys:/D [1-9]\.[1-9]/ OR navDrsys:/D [1-9]\.[1-9][0-9]/ OR navDrsys:/D [1-9][0-9]\.[1-9]/ OR navDrsys:/D [1-9][0-9]\.[1-9][0-9]/ OR navDrsys:/F [1-9]/ OR navDrsys:/F [1-9][0-9]/ OR navDrsys:/F [1-9]\.[1-9]/ OR navDrsys:/F [1-9]\.[1-9][0-9]/ OR navDrsys:/F [1-9][0-9]\.[1-9]/ OR navDrsys:/F [1-9][0-9]\.[1-9][0-9]/' DismaxParams: - [bf, 'recip(abs(ms(NOW/DAY,freshness)),3.16e-10,100,100)'] @@ -276,30 +182,6 @@ Title: - series^100 - series2 - series^200 - QueryFields: - title_short: - - [onephrase, 500] - title_alt: - - [onephrase, 450] - - [and, 400] - title_additional_dsv11_txt_mv: - - [onephrase, 450] - - [and, 400] - title_additional_gnd_txt_mv: - - [onephrase, 450] - - [and, 400] - title_sub: - - [onephrase, 400] - title_old: - - [onephrase, 300] - - [and, 250] - title_alt: - - [and, 200] - title_new: - - [and, 100] - series: - - [onephrase, 100] - - [and, 50] FilterQuery: 'institution:Z16 OR institution:A208 OR institution:A196 OR institution:B463 OR institution:B464 OR institution:B465 OR institution:B466 OR union:RE71 OR itemid_isn_mv:HSG_P* OR itemid_isn_mv:HSG_AL_220* OR itemid_isn_mv:HSG_AL_221* OR itemid_isn_mv:HSG_AL_222* OR itemid_isn_mv:HSG_AL_304* OR itemid_isn_mv:HSG_AL_414* OR itemid_isn_mv:HSG_AL_875* OR itemid_isn_mv:HSG_AN_701* OR itemid_isn_mv:HSG_MB_3300* OR itemid_isn_mv:HSG_MD_4* OR itemid_isn_mv:HSG_ME_2* OR itemid_isn_mv:HSG_ME_3* OR itemid_isn_mv:HSG_ME_4* OR itemid_isn_mv:HSG_ME_8* OR itemid_isn_mv:HSG_MF_43* OR itemid_isn_mv:HSG_MF_7050 OR itemid_isn_mv:HSG_MF_8* OR itemid_isn_mv:HSG_MK_16* OR itemid_isn_mv:HSG_MK_17* OR itemid_isn_mv:HSG_MK_38* OR itemid_isn_mv:HSG_MK_7* OR itemid_isn_mv:HSG_QD_030 OR itemid_isn_mv:HSG_QD_050 OR itemid_isn_mv:HSG_QP_44* OR itemid_isn_mv:HSG_QP_45* OR itemid_isn_mv:HSG_QP_82* OR itemid_isn_mv:HSG_Jus* OR itemid_isn_mv:HSG_GHug* OR itemid_isn_mv:LUUHL_P* OR itemid_isn_mv:BIG_BIG_EPZB* OR itemid_isn_mv:BIG_BIG_Fus_B* OR classif_ddc:34* OR classif_ddc:364* OR classif_ddc:365* OR classif_udc:34* OR classif_udc:04* OR classif_rvk:P* OR classif_rero:s1dr OR classif_rero:s2dr OR classif_912:re OR classif_912:rw OR classif_912:rs OR classif_912:dr OR classif_912:/8[0-9]0/ OR classif_912:ZB34* OR classif_912:M11* OR classif_912:M12* OR classif_912:M91 OR sublocal:340 OR navDrsys:/[1-9]/ OR navDrsys:/[1-9][0-9]/ OR navDrsys:/[1-9]\.[1-9]/ OR navDrsys:/[1-9]\.[1-9][0-9]/ OR navDrsys:/[1-9][0-9]\.[1-9]/ OR navDrsys:/[1-9][0-9]\.[1-9][0-9]/ OR navDrsys:/D [1-9]/ OR navDrsys:/D [1-9][0-9]/ OR navDrsys:/D [1-9]\.[1-9]/ OR navDrsys:/D [1-9]\.[1-9][0-9]/ OR navDrsys:/D [1-9][0-9]\.[1-9]/ OR navDrsys:/D [1-9][0-9]\.[1-9][0-9]/ OR navDrsys:/F [1-9]/ OR navDrsys:/F [1-9][0-9]/ OR navDrsys:/F [1-9]\.[1-9]/ OR navDrsys:/F [1-9]\.[1-9][0-9]/ OR navDrsys:/F [1-9][0-9]\.[1-9]/ OR navDrsys:/F [1-9][0-9]\.[1-9][0-9]/' DismaxParams: - [bf, 'recip(abs(ms(NOW/DAY,freshness)),3.16e-10,100,100)'] @@ -309,11 +191,6 @@ Series: DismaxHandler: edismax DismaxFields: - series^100 - QueryFields: - series: - - [onephrase, 500] - - [and, 200] - - [or, 100] FilterQuery: 'institution:Z16 OR institution:A208 OR institution:A196 OR institution:B463 OR institution:B464 OR institution:B465 OR institution:B466 OR union:RE71 OR itemid_isn_mv:HSG_P* OR itemid_isn_mv:HSG_AL_220* OR itemid_isn_mv:HSG_AL_221* OR itemid_isn_mv:HSG_AL_222* OR itemid_isn_mv:HSG_AL_304* OR itemid_isn_mv:HSG_AL_414* OR itemid_isn_mv:HSG_AL_875* OR itemid_isn_mv:HSG_AN_701* OR itemid_isn_mv:HSG_MB_3300* OR itemid_isn_mv:HSG_MD_4* OR itemid_isn_mv:HSG_ME_2* OR itemid_isn_mv:HSG_ME_3* OR itemid_isn_mv:HSG_ME_4* OR itemid_isn_mv:HSG_ME_8* OR itemid_isn_mv:HSG_MF_43* OR itemid_isn_mv:HSG_MF_7050 OR itemid_isn_mv:HSG_MF_8* OR itemid_isn_mv:HSG_MK_16* OR itemid_isn_mv:HSG_MK_17* OR itemid_isn_mv:HSG_MK_38* OR itemid_isn_mv:HSG_MK_7* OR itemid_isn_mv:HSG_QD_030 OR itemid_isn_mv:HSG_QD_050 OR itemid_isn_mv:HSG_QP_44* OR itemid_isn_mv:HSG_QP_45* OR itemid_isn_mv:HSG_QP_82* OR itemid_isn_mv:HSG_Jus* OR itemid_isn_mv:HSG_GHug* OR itemid_isn_mv:LUUHL_P* OR itemid_isn_mv:BIG_BIG_EPZB* OR itemid_isn_mv:BIG_BIG_Fus_B* OR classif_ddc:34* OR classif_ddc:364* OR classif_ddc:365* OR classif_udc:34* OR classif_udc:04* OR classif_rvk:P* OR classif_rero:s1dr OR classif_rero:s2dr OR classif_912:re OR classif_912:rw OR classif_912:rs OR classif_912:dr OR classif_912:/8[0-9]0/ OR classif_912:ZB34* OR classif_912:M11* OR classif_912:M12* OR classif_912:M91 OR sublocal:340 OR navDrsys:/[1-9]/ OR navDrsys:/[1-9][0-9]/ OR navDrsys:/[1-9]\.[1-9]/ OR navDrsys:/[1-9]\.[1-9][0-9]/ OR navDrsys:/[1-9][0-9]\.[1-9]/ OR navDrsys:/[1-9][0-9]\.[1-9][0-9]/ OR navDrsys:/D [1-9]/ OR navDrsys:/D [1-9][0-9]/ OR navDrsys:/D [1-9]\.[1-9]/ OR navDrsys:/D [1-9]\.[1-9][0-9]/ OR navDrsys:/D [1-9][0-9]\.[1-9]/ OR navDrsys:/D [1-9][0-9]\.[1-9][0-9]/ OR navDrsys:/F [1-9]/ OR navDrsys:/F [1-9][0-9]/ OR navDrsys:/F [1-9]\.[1-9]/ OR navDrsys:/F [1-9]\.[1-9][0-9]/ OR navDrsys:/F [1-9][0-9]\.[1-9]/ OR navDrsys:/F [1-9][0-9]\.[1-9][0-9]/' DismaxParams: - [bf, 'recip(abs(ms(NOW/DAY,freshness)),3.16e-10,100,100)'] From 694530695117c59be81a93857477025862dfd7c2 Mon Sep 17 00:00:00 2001 From: Lionel Walter Date: Tue, 9 Jul 2019 13:21:43 +0200 Subject: [PATCH 24/52] improve handling of lowercase/uppercase and accents and umlauts in suggestions --- .../View/Helper/RenderSuggestions.php | 22 +-- .../VuFind/Search/Solr/SpellingProcessor.php | 3 +- .../src/VuFind/Search/UrlQueryHelper.php | 15 ++ .../src/VuFindSearch/Query/Query.php | 186 ++++++++++++++++++ 4 files changed, 212 insertions(+), 14 deletions(-) diff --git a/module/Swissbib/src/Swissbib/View/Helper/RenderSuggestions.php b/module/Swissbib/src/Swissbib/View/Helper/RenderSuggestions.php index a4d0c5a0501..13d198b98a9 100644 --- a/module/Swissbib/src/Swissbib/View/Helper/RenderSuggestions.php +++ b/module/Swissbib/src/Swissbib/View/Helper/RenderSuggestions.php @@ -32,9 +32,11 @@ use VuFind\Search\UrlQueryHelper; use VuFindSearch\Query\Query; use Zend\View\Helper\AbstractHelper; +use Normalizer; /** * Render suggestions + * Based on renderSpellingSuggestions from VuFind * * @category Swissbib_VuFind * @package View_Helper @@ -75,30 +77,24 @@ public function __invoke($results, $view) * @var Query $initialQuery */ $initialQuery = $results->getParams()->getQuery(); - - - foreach ($suggested as $term => $suggestion) { - $initialQuery->replaceTerm($term, $suggestion); - } - - $text = $initialQuery->getString(); + $queryText = $initialQuery->getNormalizedString(); /** * Url Query Helper * - * @var UrlQueryHelper $query + * @var UrlQueryHelper $queryUrl */ - $query = $results->getUrlQuery(); + $queryUrl = $results->getUrlQuery(); foreach ($suggested as $term => $suggestion) { - $query = $query->replaceTerm($term, $suggestion); + $queryText = str_replace($term, $suggestion, $queryText); + $queryUrl = $queryUrl->replaceTermIgnoringAccents($term, $suggestion); } - - $href=$query->getParams(); + $href=$queryUrl->getParams(); - $html .= '' . $view->escapeHtml($text) + $html .= '' . $view->escapeHtml($queryText) . ''; diff --git a/module/VuFind/src/VuFind/Search/Solr/SpellingProcessor.php b/module/VuFind/src/VuFind/Search/Solr/SpellingProcessor.php index 03720d3fbc7..de6b96c1db5 100644 --- a/module/VuFind/src/VuFind/Search/Solr/SpellingProcessor.php +++ b/module/VuFind/src/VuFind/Search/Solr/SpellingProcessor.php @@ -230,7 +230,8 @@ protected function shouldSkipTerm($query, $term, $queryContains) return true; } // We should also skip terms already contained within the query: - return $queryContains == $query->containsTerm($term); + $test = $query->containsNormalizedTerm($term); + return $queryContains == $query->containsNormalizedTerm($term); } /** diff --git a/module/VuFind/src/VuFind/Search/UrlQueryHelper.php b/module/VuFind/src/VuFind/Search/UrlQueryHelper.php index 61e2e050016..c4f08d5ea0e 100644 --- a/module/VuFind/src/VuFind/Search/UrlQueryHelper.php +++ b/module/VuFind/src/VuFind/Search/UrlQueryHelper.php @@ -249,6 +249,21 @@ public function replaceTerm($from, $to) return new static($this->urlParams, $query, $this->config); } + /** + * Replace a term in the search query (used for spelling replacement) + * + * @param string $from Search term to find + * @param string $to Search term to insert + * + * @return UrlQueryHelper + */ + public function replaceTermIgnoringAccents($from, $to) + { + $query = clone $this->queryObject; + $query->replaceTermIgnoringAccents($from, $to); + return new static($this->urlParams, $query, $this->config); + } + /** * Add a facet to the parameters. * diff --git a/module/VuFindSearch/src/VuFindSearch/Query/Query.php b/module/VuFindSearch/src/VuFindSearch/Query/Query.php index 2e3d3731461..b9fddf04b34 100644 --- a/module/VuFindSearch/src/VuFindSearch/Query/Query.php +++ b/module/VuFindSearch/src/VuFindSearch/Query/Query.php @@ -84,6 +84,16 @@ public function getString() return $this->queryString; } + /** + * Return search string without accents and umlauts + * + * @return string + */ + public function getNormalizedString() + { + return strtolower($this->stripAccents($this->queryString)); + } + /** * Set the search string. * @@ -156,6 +166,29 @@ public function containsTerm($needle) return (bool)preg_match("/\b$needle\b/u", $this->getString()); } + /** + * Does the query contain the specified term? + * Accents and umlauts are removed from both + * $needle and query + * + * @param string $needle Term to check + * + * @return bool + */ + public function containsNormalizedTerm($needle) + { + // Escape characters with special meaning in regular expressions to avoid + // errors: + $needle = preg_quote($needle, '/'); + + $needle = strtolower($this->stripAccents($needle)); + + return (bool)preg_match( + "/\b$needle\b/u", + strtolower($this->stripAccents($this->getString())) + ); + } + /** * Get a concatenated list of all query strings within the object. * @@ -193,4 +226,157 @@ public function replaceTerm($from, $to) // Perform the replacement: $this->queryString = preg_replace($pattern, $to, $this->queryString); } + + /** + * Replaces a term with accents and umlauts removed + * + * @param string $from Search term to find + * @param string $to Search term to insert + * + * @return void + */ + public function replaceTermIgnoringAccents($from, $to) + { + // Escape $from so it is regular expression safe (just in case it + // includes any weird punctuation -- unlikely but possible): + $from = preg_quote($from, '/'); + + $from = $this->stripAccents($from); + + $from = strtolower($from); + + // If our "from" pattern contains non-word characters, we can't use word + // boundaries for matching. We want to try to use word boundaries when + // possible, however, to avoid the replacement from affecting unexpected + // parts of the search query. + if (!preg_match('/.*[^\w].*/', $from)) { + $pattern = "/\b$from\b/i"; + } else { + $pattern = "/$from/i"; + } + + // Perform the replacement: + $this->queryString = preg_replace( + $pattern, + $to, + strtolower($this->stripAccents($this->queryString)) + ); + } + + /** + * Remove accents and umlauts from a string + * (a better alternative might be to use iconv library) + * from https://stackoverflow.com/questions/1017599/how-do-i-remove-accents-from-characters-in-a-php-string + * + * @param string $string The text where we would like to remove accents + * + * @return string The input text with accents removed + */ + protected function stripAccents($string) + { + if (!preg_match('/[\x80-\xff]/', $string)) { + return $string; + } + + $chars = array( + // Decompositions for Latin-1 Supplement + chr(195).chr(128) => 'A', chr(195).chr(129) => 'A', + chr(195).chr(130) => 'A', chr(195).chr(131) => 'A', + chr(195).chr(132) => 'A', chr(195).chr(133) => 'A', + chr(195).chr(135) => 'C', chr(195).chr(136) => 'E', + chr(195).chr(137) => 'E', chr(195).chr(138) => 'E', + chr(195).chr(139) => 'E', chr(195).chr(140) => 'I', + chr(195).chr(141) => 'I', chr(195).chr(142) => 'I', + chr(195).chr(143) => 'I', chr(195).chr(145) => 'N', + chr(195).chr(146) => 'O', chr(195).chr(147) => 'O', + chr(195).chr(148) => 'O', chr(195).chr(149) => 'O', + chr(195).chr(150) => 'O', chr(195).chr(153) => 'U', + chr(195).chr(154) => 'U', chr(195).chr(155) => 'U', + chr(195).chr(156) => 'U', chr(195).chr(157) => 'Y', + chr(195).chr(159) => 's', chr(195).chr(160) => 'a', + chr(195).chr(161) => 'a', chr(195).chr(162) => 'a', + chr(195).chr(163) => 'a', chr(195).chr(164) => 'a', + chr(195).chr(165) => 'a', chr(195).chr(167) => 'c', + chr(195).chr(168) => 'e', chr(195).chr(169) => 'e', + chr(195).chr(170) => 'e', chr(195).chr(171) => 'e', + chr(195).chr(172) => 'i', chr(195).chr(173) => 'i', + chr(195).chr(174) => 'i', chr(195).chr(175) => 'i', + chr(195).chr(177) => 'n', chr(195).chr(178) => 'o', + chr(195).chr(179) => 'o', chr(195).chr(180) => 'o', + chr(195).chr(181) => 'o', chr(195).chr(182) => 'o', + chr(195).chr(182) => 'o', chr(195).chr(185) => 'u', + chr(195).chr(186) => 'u', chr(195).chr(187) => 'u', + chr(195).chr(188) => 'u', chr(195).chr(189) => 'y', + chr(195).chr(191) => 'y', + // Decompositions for Latin Extended-A + chr(196).chr(128) => 'A', chr(196).chr(129) => 'a', + chr(196).chr(130) => 'A', chr(196).chr(131) => 'a', + chr(196).chr(132) => 'A', chr(196).chr(133) => 'a', + chr(196).chr(134) => 'C', chr(196).chr(135) => 'c', + chr(196).chr(136) => 'C', chr(196).chr(137) => 'c', + chr(196).chr(138) => 'C', chr(196).chr(139) => 'c', + chr(196).chr(140) => 'C', chr(196).chr(141) => 'c', + chr(196).chr(142) => 'D', chr(196).chr(143) => 'd', + chr(196).chr(144) => 'D', chr(196).chr(145) => 'd', + chr(196).chr(146) => 'E', chr(196).chr(147) => 'e', + chr(196).chr(148) => 'E', chr(196).chr(149) => 'e', + chr(196).chr(150) => 'E', chr(196).chr(151) => 'e', + chr(196).chr(152) => 'E', chr(196).chr(153) => 'e', + chr(196).chr(154) => 'E', chr(196).chr(155) => 'e', + chr(196).chr(156) => 'G', chr(196).chr(157) => 'g', + chr(196).chr(158) => 'G', chr(196).chr(159) => 'g', + chr(196).chr(160) => 'G', chr(196).chr(161) => 'g', + chr(196).chr(162) => 'G', chr(196).chr(163) => 'g', + chr(196).chr(164) => 'H', chr(196).chr(165) => 'h', + chr(196).chr(166) => 'H', chr(196).chr(167) => 'h', + chr(196).chr(168) => 'I', chr(196).chr(169) => 'i', + chr(196).chr(170) => 'I', chr(196).chr(171) => 'i', + chr(196).chr(172) => 'I', chr(196).chr(173) => 'i', + chr(196).chr(174) => 'I', chr(196).chr(175) => 'i', + chr(196).chr(176) => 'I', chr(196).chr(177) => 'i', + chr(196).chr(178) => 'IJ',chr(196).chr(179) => 'ij', + chr(196).chr(180) => 'J', chr(196).chr(181) => 'j', + chr(196).chr(182) => 'K', chr(196).chr(183) => 'k', + chr(196).chr(184) => 'k', chr(196).chr(185) => 'L', + chr(196).chr(186) => 'l', chr(196).chr(187) => 'L', + chr(196).chr(188) => 'l', chr(196).chr(189) => 'L', + chr(196).chr(190) => 'l', chr(196).chr(191) => 'L', + chr(197).chr(128) => 'l', chr(197).chr(129) => 'L', + chr(197).chr(130) => 'l', chr(197).chr(131) => 'N', + chr(197).chr(132) => 'n', chr(197).chr(133) => 'N', + chr(197).chr(134) => 'n', chr(197).chr(135) => 'N', + chr(197).chr(136) => 'n', chr(197).chr(137) => 'N', + chr(197).chr(138) => 'n', chr(197).chr(139) => 'N', + chr(197).chr(140) => 'O', chr(197).chr(141) => 'o', + chr(197).chr(142) => 'O', chr(197).chr(143) => 'o', + chr(197).chr(144) => 'O', chr(197).chr(145) => 'o', + chr(197).chr(146) => 'OE',chr(197).chr(147) => 'oe', + chr(197).chr(148) => 'R',chr(197).chr(149) => 'r', + chr(197).chr(150) => 'R',chr(197).chr(151) => 'r', + chr(197).chr(152) => 'R',chr(197).chr(153) => 'r', + chr(197).chr(154) => 'S',chr(197).chr(155) => 's', + chr(197).chr(156) => 'S',chr(197).chr(157) => 's', + chr(197).chr(158) => 'S',chr(197).chr(159) => 's', + chr(197).chr(160) => 'S', chr(197).chr(161) => 's', + chr(197).chr(162) => 'T', chr(197).chr(163) => 't', + chr(197).chr(164) => 'T', chr(197).chr(165) => 't', + chr(197).chr(166) => 'T', chr(197).chr(167) => 't', + chr(197).chr(168) => 'U', chr(197).chr(169) => 'u', + chr(197).chr(170) => 'U', chr(197).chr(171) => 'u', + chr(197).chr(172) => 'U', chr(197).chr(173) => 'u', + chr(197).chr(174) => 'U', chr(197).chr(175) => 'u', + chr(197).chr(176) => 'U', chr(197).chr(177) => 'u', + chr(197).chr(178) => 'U', chr(197).chr(179) => 'u', + chr(197).chr(180) => 'W', chr(197).chr(181) => 'w', + chr(197).chr(182) => 'Y', chr(197).chr(183) => 'y', + chr(197).chr(184) => 'Y', chr(197).chr(185) => 'Z', + chr(197).chr(186) => 'z', chr(197).chr(187) => 'Z', + chr(197).chr(188) => 'z', chr(197).chr(189) => 'Z', + chr(197).chr(190) => 'z', chr(197).chr(191) => 's' + ); + + $string = strtr($string, $chars); + + return $string; + } } From 15a9f14d227c6ec46a14120cc5f2ff1c91798a6a Mon Sep 17 00:00:00 2001 From: Lionel Walter Date: Tue, 9 Jul 2019 16:06:01 +0200 Subject: [PATCH 25/52] rename and refactor methods --- .../VuFind/Search/Solr/SpellingProcessor.php | 1 - .../src/VuFind/Search/UrlQueryHelper.php | 25 ++++---------- .../src/VuFind/View/Helper/AbstractSearch.php | 14 ++++++-- .../src/VuFindSearch/Query/Query.php | 33 ++++++++++++++----- 4 files changed, 43 insertions(+), 30 deletions(-) diff --git a/module/VuFind/src/VuFind/Search/Solr/SpellingProcessor.php b/module/VuFind/src/VuFind/Search/Solr/SpellingProcessor.php index de6b96c1db5..32a4db63568 100644 --- a/module/VuFind/src/VuFind/Search/Solr/SpellingProcessor.php +++ b/module/VuFind/src/VuFind/Search/Solr/SpellingProcessor.php @@ -230,7 +230,6 @@ protected function shouldSkipTerm($query, $term, $queryContains) return true; } // We should also skip terms already contained within the query: - $test = $query->containsNormalizedTerm($term); return $queryContains == $query->containsNormalizedTerm($term); } diff --git a/module/VuFind/src/VuFind/Search/UrlQueryHelper.php b/module/VuFind/src/VuFind/Search/UrlQueryHelper.php index c4f08d5ea0e..eb14dbc2177 100644 --- a/module/VuFind/src/VuFind/Search/UrlQueryHelper.php +++ b/module/VuFind/src/VuFind/Search/UrlQueryHelper.php @@ -242,25 +242,14 @@ public function __toString() * * @return UrlQueryHelper */ - public function replaceTerm($from, $to) - { - $query = clone $this->queryObject; - $query->replaceTerm($from, $to); - return new static($this->urlParams, $query, $this->config); - } - - /** - * Replace a term in the search query (used for spelling replacement) - * - * @param string $from Search term to find - * @param string $to Search term to insert - * - * @return UrlQueryHelper - */ - public function replaceTermIgnoringAccents($from, $to) - { + public function replaceTerm( + $from, + $to, + $ignoreCase = false, + $ignoreDiacritics = false + ) { $query = clone $this->queryObject; - $query->replaceTermIgnoringAccents($from, $to); + $query->replaceTerm($from, $to, $ignoreCase, $ignoreDiacritics); return new static($this->urlParams, $query, $this->config); } diff --git a/module/VuFind/src/VuFind/View/Helper/AbstractSearch.php b/module/VuFind/src/VuFind/View/Helper/AbstractSearch.php index 00d20f35986..e76ba258c82 100644 --- a/module/VuFind/src/VuFind/View/Helper/AbstractSearch.php +++ b/module/VuFind/src/VuFind/View/Helper/AbstractSearch.php @@ -84,12 +84,22 @@ public function renderSpellingSuggestions($msg, $results, $view) $html .= ', '; } $href = $results->getUrlQuery() - ->replaceTerm($term, $data['new_term'])->getParams(); + ->replaceTerm( + $term, + $data['new_term'], + true, + true + )->getParams(); $html .= '' . $view->escapeHtml($word) . ''; if (isset($data['expand_term']) && !empty($data['expand_term'])) { $url = $results->getUrlQuery() - ->replaceTerm($term, $data['expand_term'])->getParams(); + ->replaceTerm( + $term, + $data['expand_term'], + true, + true + )->getParams(); $html .= $this->renderExpandLink($url, $view); } } diff --git a/module/VuFindSearch/src/VuFindSearch/Query/Query.php b/module/VuFindSearch/src/VuFindSearch/Query/Query.php index b9fddf04b34..254f5d124de 100644 --- a/module/VuFindSearch/src/VuFindSearch/Query/Query.php +++ b/module/VuFindSearch/src/VuFindSearch/Query/Query.php @@ -91,7 +91,7 @@ public function getString() */ public function getNormalizedString() { - return strtolower($this->stripAccents($this->queryString)); + return strtolower($this->stripDiacritics($this->queryString)); } /** @@ -181,11 +181,11 @@ public function containsNormalizedTerm($needle) // errors: $needle = preg_quote($needle, '/'); - $needle = strtolower($this->stripAccents($needle)); + $needle = strtolower($this->stripDiacritics($needle)); return (bool)preg_match( "/\b$needle\b/u", - strtolower($this->stripAccents($this->getString())) + strtolower($this->stripDiacritics($this->getString())) ); } @@ -207,11 +207,26 @@ public function getAllTerms() * * @return void */ - public function replaceTerm($from, $to) - { + public function replaceTerm( + $from, + $to, + $ignoreCase = false, + $ignoreDiacritics = false + ) { // Escape $from so it is regular expression safe (just in case it // includes any weird punctuation -- unlikely but possible): $from = preg_quote($from, '/'); + $queryString = $this->queryString; + + if ($ignoreCase) { + $from = strtolower($from); + $queryString = strtolower($queryString); + } + + if ($ignoreDiacritics) { + $from = $this->stripDiacritics($from); + $queryString = $this->stripDiacritics($queryString); + } // If our "from" pattern contains non-word characters, we can't use word // boundaries for matching. We want to try to use word boundaries when @@ -224,7 +239,7 @@ public function replaceTerm($from, $to) } // Perform the replacement: - $this->queryString = preg_replace($pattern, $to, $this->queryString); + $this->queryString = preg_replace($pattern, $to, $queryString); } /** @@ -241,7 +256,7 @@ public function replaceTermIgnoringAccents($from, $to) // includes any weird punctuation -- unlikely but possible): $from = preg_quote($from, '/'); - $from = $this->stripAccents($from); + $from = $this->stripDiacritics($from); $from = strtolower($from); @@ -259,7 +274,7 @@ public function replaceTermIgnoringAccents($from, $to) $this->queryString = preg_replace( $pattern, $to, - strtolower($this->stripAccents($this->queryString)) + strtolower($this->stripDiacritics($this->queryString)) ); } @@ -272,7 +287,7 @@ public function replaceTermIgnoringAccents($from, $to) * * @return string The input text with accents removed */ - protected function stripAccents($string) + protected function stripDiacritics($string) { if (!preg_match('/[\x80-\xff]/', $string)) { return $string; From 0c08f2226fc05d49a505787c661de9f805e93575 Mon Sep 17 00:00:00 2001 From: Lionel Walter Date: Tue, 9 Jul 2019 16:11:39 +0200 Subject: [PATCH 26/52] fix wrong method name --- module/Swissbib/src/Swissbib/View/Helper/RenderSuggestions.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module/Swissbib/src/Swissbib/View/Helper/RenderSuggestions.php b/module/Swissbib/src/Swissbib/View/Helper/RenderSuggestions.php index 13d198b98a9..a7d8e185d86 100644 --- a/module/Swissbib/src/Swissbib/View/Helper/RenderSuggestions.php +++ b/module/Swissbib/src/Swissbib/View/Helper/RenderSuggestions.php @@ -88,7 +88,7 @@ public function __invoke($results, $view) foreach ($suggested as $term => $suggestion) { $queryText = str_replace($term, $suggestion, $queryText); - $queryUrl = $queryUrl->replaceTermIgnoringAccents($term, $suggestion); + $queryUrl = $queryUrl->replaceTerm($term, $suggestion, true, true); } $href=$queryUrl->getParams(); From 6637b613ea40e3284574a723eed08698fcc63137 Mon Sep 17 00:00:00 2001 From: ClaudiaSchumacher <45592901+ClaudiaSchumacher@users.noreply.github.com> Date: Tue, 9 Jul 2019 16:40:40 +0200 Subject: [PATCH 27/52] Update faq.phtml --- themes/sbvfrdmulti/templates/HelpPage/en/faq.phtml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/themes/sbvfrdmulti/templates/HelpPage/en/faq.phtml b/themes/sbvfrdmulti/templates/HelpPage/en/faq.phtml index 801fbec33e1..2bb652a6085 100644 --- a/themes/sbvfrdmulti/templates/HelpPage/en/faq.phtml +++ b/themes/sbvfrdmulti/templates/HelpPage/en/faq.phtml @@ -268,7 +268,7 @@

Possible reasons include:

  • You have not accessed the network of the library that has copyright for this item.
  • -
  • You have not activated the VPN-Client (Basel or Bern) , which gives you access.
  • +
  • You have not activated the VPN-Client (Basel or Bern) , which gives you access.
  • You are not a member of the network and can only access public items outside of the library. You can filter your results for Free Access Online under Refine search.
From 81b873f04b60f7f1bfac8bf48f22ef43abfbf5e8 Mon Sep 17 00:00:00 2001 From: Lionel Walter Date: Tue, 9 Jul 2019 16:56:14 +0200 Subject: [PATCH 28/52] improve phpdoc and add the missing method to queryGroup --- .../src/VuFind/Search/UrlQueryHelper.php | 9 +++- .../src/VuFindSearch/Query/Query.php | 9 +++- .../src/VuFindSearch/Query/QueryGroup.php | 42 ++++++++++++++++--- 3 files changed, 51 insertions(+), 9 deletions(-) diff --git a/module/VuFind/src/VuFind/Search/UrlQueryHelper.php b/module/VuFind/src/VuFind/Search/UrlQueryHelper.php index eb14dbc2177..cb2673b3740 100644 --- a/module/VuFind/src/VuFind/Search/UrlQueryHelper.php +++ b/module/VuFind/src/VuFind/Search/UrlQueryHelper.php @@ -237,8 +237,13 @@ public function __toString() /** * Replace a term in the search query (used for spelling replacement) * - * @param string $from Search term to find - * @param string $to Search term to insert + * @param string $from Search term to find + * @param string $to Search term to insert + * @param boolean $ignoreCase If we should ignore the case differences + * when replacing + * @param boolean $ignoreDiacritics If we should ignore the diacritics when + * replacing, i.e. if $from is durenmatt, + * it could replace dürenmatt in the query * * @return UrlQueryHelper */ diff --git a/module/VuFindSearch/src/VuFindSearch/Query/Query.php b/module/VuFindSearch/src/VuFindSearch/Query/Query.php index 254f5d124de..6a0e146d8bc 100644 --- a/module/VuFindSearch/src/VuFindSearch/Query/Query.php +++ b/module/VuFindSearch/src/VuFindSearch/Query/Query.php @@ -202,8 +202,13 @@ public function getAllTerms() /** * Replace a term. * - * @param string $from Search term to find - * @param string $to Search term to insert + * @param string $from Search term to find + * @param string $to Search term to insert + * @param boolean $ignoreCase If we should ignore the case differences + * when replacing + * @param boolean $ignoreDiacritics If we should ignore the diacritics when + * replacing, i.e. if $from is durenmatt, + * it could replace dürenmatt in the query * * @return void */ diff --git a/module/VuFindSearch/src/VuFindSearch/Query/QueryGroup.php b/module/VuFindSearch/src/VuFindSearch/Query/QueryGroup.php index 3a03e2af1c8..f2d6856f3a9 100644 --- a/module/VuFindSearch/src/VuFindSearch/Query/QueryGroup.php +++ b/module/VuFindSearch/src/VuFindSearch/Query/QueryGroup.php @@ -253,6 +253,24 @@ public function containsTerm($needle) return false; } + /** + * Does the query contain the specified term? + * Diacritics and case are ignored + * + * @param string $needle Term to check + * + * @return bool + */ + public function containsNormalizedTerm($needle) + { + foreach ($this->getQueries() as $q) { + if ($q->containsNormalizedTerm($needle)) { + return true; + } + } + return false; + } + /** * Get a concatenated list of all query strings within the object. * @@ -270,15 +288,29 @@ public function getAllTerms() /** * Replace a term. * - * @param string $from Search term to find - * @param string $to Search term to insert + * @param string $from Search term to find + * @param string $to Search term to insert + * @param boolean $ignoreCase If we should ignore the case differences + * when replacing + * @param boolean $ignoreDiacritics If we should ignore the diacritics when + * replacing, i.e. if $from is durenmatt, + * it could replace dürenmatt in the query * * @return void */ - public function replaceTerm($from, $to) - { + public function replaceTerm( + $from, + $to, + $ignoreCase = false, + $ignoreDiacritics = false + ) { foreach ($this->getQueries() as $q) { - $q->replaceTerm($from, $to); + $q->replaceTerm( + $from, + $to, + $ignoreCase, + $ignoreDiacritics + ); } } } From 300d3dd18e1c1f2cee527aeb24031b7ab96b59a3 Mon Sep 17 00:00:00 2001 From: Lionel Walter Date: Tue, 9 Jul 2019 17:23:15 +0200 Subject: [PATCH 29/52] fix code style --- .../src/VuFindSearch/Query/Query.php | 190 +++++++++--------- 1 file changed, 95 insertions(+), 95 deletions(-) diff --git a/module/VuFindSearch/src/VuFindSearch/Query/Query.php b/module/VuFindSearch/src/VuFindSearch/Query/Query.php index 6a0e146d8bc..2e61caae859 100644 --- a/module/VuFindSearch/src/VuFindSearch/Query/Query.php +++ b/module/VuFindSearch/src/VuFindSearch/Query/Query.php @@ -286,7 +286,7 @@ public function replaceTermIgnoringAccents($from, $to) /** * Remove accents and umlauts from a string * (a better alternative might be to use iconv library) - * from https://stackoverflow.com/questions/1017599/how-do-i-remove-accents-from-characters-in-a-php-string + * from https://stackoverflow.com/questions/1017599 * * @param string $string The text where we would like to remove accents * @@ -298,102 +298,102 @@ protected function stripDiacritics($string) return $string; } - $chars = array( + $chars = [ // Decompositions for Latin-1 Supplement - chr(195).chr(128) => 'A', chr(195).chr(129) => 'A', - chr(195).chr(130) => 'A', chr(195).chr(131) => 'A', - chr(195).chr(132) => 'A', chr(195).chr(133) => 'A', - chr(195).chr(135) => 'C', chr(195).chr(136) => 'E', - chr(195).chr(137) => 'E', chr(195).chr(138) => 'E', - chr(195).chr(139) => 'E', chr(195).chr(140) => 'I', - chr(195).chr(141) => 'I', chr(195).chr(142) => 'I', - chr(195).chr(143) => 'I', chr(195).chr(145) => 'N', - chr(195).chr(146) => 'O', chr(195).chr(147) => 'O', - chr(195).chr(148) => 'O', chr(195).chr(149) => 'O', - chr(195).chr(150) => 'O', chr(195).chr(153) => 'U', - chr(195).chr(154) => 'U', chr(195).chr(155) => 'U', - chr(195).chr(156) => 'U', chr(195).chr(157) => 'Y', - chr(195).chr(159) => 's', chr(195).chr(160) => 'a', - chr(195).chr(161) => 'a', chr(195).chr(162) => 'a', - chr(195).chr(163) => 'a', chr(195).chr(164) => 'a', - chr(195).chr(165) => 'a', chr(195).chr(167) => 'c', - chr(195).chr(168) => 'e', chr(195).chr(169) => 'e', - chr(195).chr(170) => 'e', chr(195).chr(171) => 'e', - chr(195).chr(172) => 'i', chr(195).chr(173) => 'i', - chr(195).chr(174) => 'i', chr(195).chr(175) => 'i', - chr(195).chr(177) => 'n', chr(195).chr(178) => 'o', - chr(195).chr(179) => 'o', chr(195).chr(180) => 'o', - chr(195).chr(181) => 'o', chr(195).chr(182) => 'o', - chr(195).chr(182) => 'o', chr(195).chr(185) => 'u', - chr(195).chr(186) => 'u', chr(195).chr(187) => 'u', - chr(195).chr(188) => 'u', chr(195).chr(189) => 'y', - chr(195).chr(191) => 'y', + chr(195) . chr(128) => 'A', chr(195) . chr(129) => 'A', + chr(195) . chr(130) => 'A', chr(195) . chr(131) => 'A', + chr(195) . chr(132) => 'A', chr(195) . chr(133) => 'A', + chr(195) . chr(135) => 'C', chr(195) . chr(136) => 'E', + chr(195) . chr(137) => 'E', chr(195) . chr(138) => 'E', + chr(195) . chr(139) => 'E', chr(195) . chr(140) => 'I', + chr(195) . chr(141) => 'I', chr(195) . chr(142) => 'I', + chr(195) . chr(143) => 'I', chr(195) . chr(145) => 'N', + chr(195) . chr(146) => 'O', chr(195) . chr(147) => 'O', + chr(195) . chr(148) => 'O', chr(195) . chr(149) => 'O', + chr(195) . chr(150) => 'O', chr(195) . chr(153) => 'U', + chr(195) . chr(154) => 'U', chr(195) . chr(155) => 'U', + chr(195) . chr(156) => 'U', chr(195) . chr(157) => 'Y', + chr(195) . chr(159) => 's', chr(195) . chr(160) => 'a', + chr(195) . chr(161) => 'a', chr(195) . chr(162) => 'a', + chr(195) . chr(163) => 'a', chr(195) . chr(164) => 'a', + chr(195) . chr(165) => 'a', chr(195) . chr(167) => 'c', + chr(195) . chr(168) => 'e', chr(195) . chr(169) => 'e', + chr(195) . chr(170) => 'e', chr(195) . chr(171) => 'e', + chr(195) . chr(172) => 'i', chr(195) . chr(173) => 'i', + chr(195) . chr(174) => 'i', chr(195) . chr(175) => 'i', + chr(195) . chr(177) => 'n', chr(195) . chr(178) => 'o', + chr(195) . chr(179) => 'o', chr(195) . chr(180) => 'o', + chr(195) . chr(181) => 'o', chr(195) . chr(182) => 'o', + chr(195) . chr(182) => 'o', chr(195) . chr(185) => 'u', + chr(195) . chr(186) => 'u', chr(195) . chr(187) => 'u', + chr(195) . chr(188) => 'u', chr(195) . chr(189) => 'y', + chr(195) . chr(191) => 'y', // Decompositions for Latin Extended-A - chr(196).chr(128) => 'A', chr(196).chr(129) => 'a', - chr(196).chr(130) => 'A', chr(196).chr(131) => 'a', - chr(196).chr(132) => 'A', chr(196).chr(133) => 'a', - chr(196).chr(134) => 'C', chr(196).chr(135) => 'c', - chr(196).chr(136) => 'C', chr(196).chr(137) => 'c', - chr(196).chr(138) => 'C', chr(196).chr(139) => 'c', - chr(196).chr(140) => 'C', chr(196).chr(141) => 'c', - chr(196).chr(142) => 'D', chr(196).chr(143) => 'd', - chr(196).chr(144) => 'D', chr(196).chr(145) => 'd', - chr(196).chr(146) => 'E', chr(196).chr(147) => 'e', - chr(196).chr(148) => 'E', chr(196).chr(149) => 'e', - chr(196).chr(150) => 'E', chr(196).chr(151) => 'e', - chr(196).chr(152) => 'E', chr(196).chr(153) => 'e', - chr(196).chr(154) => 'E', chr(196).chr(155) => 'e', - chr(196).chr(156) => 'G', chr(196).chr(157) => 'g', - chr(196).chr(158) => 'G', chr(196).chr(159) => 'g', - chr(196).chr(160) => 'G', chr(196).chr(161) => 'g', - chr(196).chr(162) => 'G', chr(196).chr(163) => 'g', - chr(196).chr(164) => 'H', chr(196).chr(165) => 'h', - chr(196).chr(166) => 'H', chr(196).chr(167) => 'h', - chr(196).chr(168) => 'I', chr(196).chr(169) => 'i', - chr(196).chr(170) => 'I', chr(196).chr(171) => 'i', - chr(196).chr(172) => 'I', chr(196).chr(173) => 'i', - chr(196).chr(174) => 'I', chr(196).chr(175) => 'i', - chr(196).chr(176) => 'I', chr(196).chr(177) => 'i', - chr(196).chr(178) => 'IJ',chr(196).chr(179) => 'ij', - chr(196).chr(180) => 'J', chr(196).chr(181) => 'j', - chr(196).chr(182) => 'K', chr(196).chr(183) => 'k', - chr(196).chr(184) => 'k', chr(196).chr(185) => 'L', - chr(196).chr(186) => 'l', chr(196).chr(187) => 'L', - chr(196).chr(188) => 'l', chr(196).chr(189) => 'L', - chr(196).chr(190) => 'l', chr(196).chr(191) => 'L', - chr(197).chr(128) => 'l', chr(197).chr(129) => 'L', - chr(197).chr(130) => 'l', chr(197).chr(131) => 'N', - chr(197).chr(132) => 'n', chr(197).chr(133) => 'N', - chr(197).chr(134) => 'n', chr(197).chr(135) => 'N', - chr(197).chr(136) => 'n', chr(197).chr(137) => 'N', - chr(197).chr(138) => 'n', chr(197).chr(139) => 'N', - chr(197).chr(140) => 'O', chr(197).chr(141) => 'o', - chr(197).chr(142) => 'O', chr(197).chr(143) => 'o', - chr(197).chr(144) => 'O', chr(197).chr(145) => 'o', - chr(197).chr(146) => 'OE',chr(197).chr(147) => 'oe', - chr(197).chr(148) => 'R',chr(197).chr(149) => 'r', - chr(197).chr(150) => 'R',chr(197).chr(151) => 'r', - chr(197).chr(152) => 'R',chr(197).chr(153) => 'r', - chr(197).chr(154) => 'S',chr(197).chr(155) => 's', - chr(197).chr(156) => 'S',chr(197).chr(157) => 's', - chr(197).chr(158) => 'S',chr(197).chr(159) => 's', - chr(197).chr(160) => 'S', chr(197).chr(161) => 's', - chr(197).chr(162) => 'T', chr(197).chr(163) => 't', - chr(197).chr(164) => 'T', chr(197).chr(165) => 't', - chr(197).chr(166) => 'T', chr(197).chr(167) => 't', - chr(197).chr(168) => 'U', chr(197).chr(169) => 'u', - chr(197).chr(170) => 'U', chr(197).chr(171) => 'u', - chr(197).chr(172) => 'U', chr(197).chr(173) => 'u', - chr(197).chr(174) => 'U', chr(197).chr(175) => 'u', - chr(197).chr(176) => 'U', chr(197).chr(177) => 'u', - chr(197).chr(178) => 'U', chr(197).chr(179) => 'u', - chr(197).chr(180) => 'W', chr(197).chr(181) => 'w', - chr(197).chr(182) => 'Y', chr(197).chr(183) => 'y', - chr(197).chr(184) => 'Y', chr(197).chr(185) => 'Z', - chr(197).chr(186) => 'z', chr(197).chr(187) => 'Z', - chr(197).chr(188) => 'z', chr(197).chr(189) => 'Z', - chr(197).chr(190) => 'z', chr(197).chr(191) => 's' - ); + chr(196) . chr(128) => 'A', chr(196) . chr(129) => 'a', + chr(196) . chr(130) => 'A', chr(196) . chr(131) => 'a', + chr(196) . chr(132) => 'A', chr(196) . chr(133) => 'a', + chr(196) . chr(134) => 'C', chr(196) . chr(135) => 'c', + chr(196) . chr(136) => 'C', chr(196) . chr(137) => 'c', + chr(196) . chr(138) => 'C', chr(196) . chr(139) => 'c', + chr(196) . chr(140) => 'C', chr(196) . chr(141) => 'c', + chr(196) . chr(142) => 'D', chr(196) . chr(143) => 'd', + chr(196) . chr(144) => 'D', chr(196) . chr(145) => 'd', + chr(196) . chr(146) => 'E', chr(196) . chr(147) => 'e', + chr(196) . chr(148) => 'E', chr(196) . chr(149) => 'e', + chr(196) . chr(150) => 'E', chr(196) . chr(151) => 'e', + chr(196) . chr(152) => 'E', chr(196) . chr(153) => 'e', + chr(196) . chr(154) => 'E', chr(196) . chr(155) => 'e', + chr(196) . chr(156) => 'G', chr(196) . chr(157) => 'g', + chr(196) . chr(158) => 'G', chr(196) . chr(159) => 'g', + chr(196) . chr(160) => 'G', chr(196) . chr(161) => 'g', + chr(196) . chr(162) => 'G', chr(196) . chr(163) => 'g', + chr(196) . chr(164) => 'H', chr(196) . chr(165) => 'h', + chr(196) . chr(166) => 'H', chr(196) . chr(167) => 'h', + chr(196) . chr(168) => 'I', chr(196) . chr(169) => 'i', + chr(196) . chr(170) => 'I', chr(196) . chr(171) => 'i', + chr(196) . chr(172) => 'I', chr(196) . chr(173) => 'i', + chr(196) . chr(174) => 'I', chr(196) . chr(175) => 'i', + chr(196) . chr(176) => 'I', chr(196) . chr(177) => 'i', + chr(196) . chr(178) => 'IJ',chr(196) . chr(179) => 'ij', + chr(196) . chr(180) => 'J', chr(196) . chr(181) => 'j', + chr(196) . chr(182) => 'K', chr(196) . chr(183) => 'k', + chr(196) . chr(184) => 'k', chr(196) . chr(185) => 'L', + chr(196) . chr(186) => 'l', chr(196) . chr(187) => 'L', + chr(196) . chr(188) => 'l', chr(196) . chr(189) => 'L', + chr(196) . chr(190) => 'l', chr(196) . chr(191) => 'L', + chr(197) . chr(128) => 'l', chr(197) . chr(129) => 'L', + chr(197) . chr(130) => 'l', chr(197) . chr(131) => 'N', + chr(197) . chr(132) => 'n', chr(197) . chr(133) => 'N', + chr(197) . chr(134) => 'n', chr(197) . chr(135) => 'N', + chr(197) . chr(136) => 'n', chr(197) . chr(137) => 'N', + chr(197) . chr(138) => 'n', chr(197) . chr(139) => 'N', + chr(197) . chr(140) => 'O', chr(197) . chr(141) => 'o', + chr(197) . chr(142) => 'O', chr(197) . chr(143) => 'o', + chr(197) . chr(144) => 'O', chr(197) . chr(145) => 'o', + chr(197) . chr(146) => 'OE',chr(197) . chr(147) => 'oe', + chr(197) . chr(148) => 'R',chr(197) . chr(149) => 'r', + chr(197) . chr(150) => 'R',chr(197) . chr(151) => 'r', + chr(197) . chr(152) => 'R',chr(197) . chr(153) => 'r', + chr(197) . chr(154) => 'S',chr(197) . chr(155) => 's', + chr(197) . chr(156) => 'S',chr(197) . chr(157) => 's', + chr(197) . chr(158) => 'S',chr(197) . chr(159) => 's', + chr(197) . chr(160) => 'S', chr(197) . chr(161) => 's', + chr(197) . chr(162) => 'T', chr(197) . chr(163) => 't', + chr(197) . chr(164) => 'T', chr(197) . chr(165) => 't', + chr(197) . chr(166) => 'T', chr(197) . chr(167) => 't', + chr(197) . chr(168) => 'U', chr(197) . chr(169) => 'u', + chr(197) . chr(170) => 'U', chr(197) . chr(171) => 'u', + chr(197) . chr(172) => 'U', chr(197) . chr(173) => 'u', + chr(197) . chr(174) => 'U', chr(197) . chr(175) => 'u', + chr(197) . chr(176) => 'U', chr(197) . chr(177) => 'u', + chr(197) . chr(178) => 'U', chr(197) . chr(179) => 'u', + chr(197) . chr(180) => 'W', chr(197) . chr(181) => 'w', + chr(197) . chr(182) => 'Y', chr(197) . chr(183) => 'y', + chr(197) . chr(184) => 'Y', chr(197) . chr(185) => 'Z', + chr(197) . chr(186) => 'z', chr(197) . chr(187) => 'Z', + chr(197) . chr(188) => 'z', chr(197) . chr(189) => 'Z', + chr(197) . chr(190) => 'z', chr(197) . chr(191) => 's' + ]; $string = strtr($string, $chars); From 8f99878bd69fdbc2aef44ea338763ac0606c831e Mon Sep 17 00:00:00 2001 From: Silvia Witzig Date: Thu, 11 Jul 2019 10:32:19 +0200 Subject: [PATCH 30/52] =?UTF-8?q?Anpassungen=20Fachbereichsfacette:=20Posi?= =?UTF-8?q?tion=20und=20=C3=9Cbersetzungen?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- local/config/vufind/facets_baselbern.ini | 2 +- local/languages/ddc/en.ini | 10 +++++----- local/languages/ddc/fr.ini | 12 ++++++------ local/languages/ddc/it.ini | 14 +++++++------- local/languages/de.ini | 1 - local/languages/en.ini | 1 - local/languages/fr.ini | 1 - local/languages/it.ini | 1 - 8 files changed, 19 insertions(+), 23 deletions(-) diff --git a/local/config/vufind/facets_baselbern.ini b/local/config/vufind/facets_baselbern.ini index aa70b3962d6..4d461769f70 100644 --- a/local/config/vufind/facets_baselbern.ini +++ b/local/config/vufind/facets_baselbern.ini @@ -8,8 +8,8 @@ override_full_sections = "Results,ResultsTop,Advanced,SpecialFacets,HomePage" [Results] e_institution_str_mv = onlineAvailable institution = Institution -classif_ddc_facet = subjectArea navSub_orange = "Suggested Topics" +classif_ddc_facet = Subject Area navAuthor_orange = Author format_hierarchy_str_mv = Format language = Language diff --git a/local/languages/ddc/en.ini b/local/languages/ddc/en.ini index 40a5a060907..84dbe5be3a3 100644 --- a/local/languages/ddc/en.ini +++ b/local/languages/ddc/en.ini @@ -1,7 +1,7 @@ ; Translation for DDC facet -0/0/ = "Computer science, information and general works" +0/0/ = "Computer Science, Information and General Works" 1/0/0/ = "General Works, Computer Science, Digital Humanities" 1/0/1/ = "Bibliography" 1/0/2/ = "Library and Information Sciences" @@ -12,7 +12,7 @@ 1/0/8/ = "General Collections, Quotations" 1/0/9/ = "Books, Manuscripts" -0/1/ = "Philosophy and psychology +0/1/ = "Philosophy and Psychology 1/1/0/ = "Philosophy" 1/1/3/ = "Parapsychology, Occultism" 1/1/5/ = "Psychology" @@ -58,7 +58,7 @@ 1/5/8/ = "Plants, Botany" 1/5/9/ = "Animals, Zoology, Human Biology" -0/6/ = "Technology" +0/6/ = "Applied Sciences" 1/6/0/ = "Technology" 1/6/1/ = "Medicine, Health, Pharmacology" 1/6/2/ = "Engineering, Mechanical Engineering and Machinery" @@ -69,7 +69,7 @@ 1/6/7/ = "Manufacturing" 1/6/9/ = "Construction of Buildings, Building Craft" -0/7/ = "Arts and recration" +0/7/ = "Arts and Entertainment" 1/7/0/ = "The Arts, Plastic Art" 1/7/1/ = "Landscape Architecture, Area Planning" 1/7/2/ = "Architecture" @@ -93,7 +93,7 @@ 1/8/8/ = "Classical Greek Literature, Modern Greek Literature" 1/8/9/ = "Slavic Literature, Arabic literature, Turkish Literature, Literature of other Languages" -0/9/ = "History and geography" +0/9/ = "History and Geography" 1/9/0/ = "History" 1/9/1/ = "Geography, Travel" 1/9/2/ = "Biography, Genealogy, Insignia" diff --git a/local/languages/ddc/fr.ini b/local/languages/ddc/fr.ini index db9346ce565..d0f4ef84c92 100644 --- a/local/languages/ddc/fr.ini +++ b/local/languages/ddc/fr.ini @@ -1,7 +1,7 @@ ; Translation for DDC facet -0/0/ = "Informatique, information, ouvrages généraux" +0/0/ = "Généralités, informatique, sciences de l’information" 1/0/0/ = "Généralités, Informatique, Digital Humanities" 1/0/1/ = "Bibliographies" 1/0/2/ = "Bibliothéconomie et sciences de l’information" @@ -12,7 +12,7 @@ 1/0/8/ = "Recueils, Recueils de citations" 1/0/9/ = "Livres rares, Manuscrits" -0/1/ = "Philosophie, Parapsychologie et Occultisme, Psychologie" +0/1/ = "Philosophie et Psychologie" 1/1/0/ = "Philosophie" 1/1/3/ = "Parapsychologie, Occultisme" 1/1/5/ = "Psychologie" @@ -58,7 +58,7 @@ 1/5/8/ = "Plantes, Botanique" 1/5/9/ = "Animaux, Zoologie" -0/6/ = "Technologie" +0/6/ = "Technologie, Médecine, Sciences appliquées" 1/6/0/ = "Technologie" 1/6/1/ = "Médecine, Santé, Pharmacie" 1/6/2/ = "Art de l’ingénieur, Génie mécanique" @@ -69,7 +69,7 @@ 1/6/7/ = "Fabrication industrielle" 1/6/9/ = "Bâtiments, Construction" -0/7/ = "Arts, Loisirs et Sports" +0/7/ = "Arts et Loisirs" 1/7/0/ = "Arts, Beaux-Arts en général" 1/7/1/ = "Art du paysage, Urbanisme" 1/7/2/ = "Architecture" @@ -81,7 +81,7 @@ 1/7/8/ = "Musique, Partitions, Enregistrements" 1/7/9/ = "Loisirs, Arts du spectacle" -0/8/ = "Littérature et techniques d’écriture" +0/8/ = "Littérature" 1/8/0/ = "Littérature, Rhétorique" 1/8/1/ = "Littérature américaine de langue anglaise" 1/8/2/ = "Littératures anglaise" @@ -93,7 +93,7 @@ 1/8/8/ = "Littératures des langues helléniques, Littérature grecque" 1/8/9/ = "Littératures slave, arabe et turque, Littérature des autres langues" -0/9/ = "Géographie et Histoire" +0/9/ = "Histoire et Géographie" 1/9/0/ = "Histoire" 1/9/1/ = "Géographie, Voyages" 1/9/2/ = "Biographie, Généalogie, Héraldique" diff --git a/local/languages/ddc/it.ini b/local/languages/ddc/it.ini index 314609afd25..149e3601674 100644 --- a/local/languages/ddc/it.ini +++ b/local/languages/ddc/it.ini @@ -1,7 +1,7 @@ ; Translation for DDC facet -0/0/ = "Informatica, scienze dell'informazione, opere generali" +0/0/ = "Generalità, informatica, scienze dell’informazione" 1/0/0/ = "Generalità, informatica, informatica umanistica" 1/0/1/ = "Bibliografie" 1/0/2/ = "Biblioteconomia e scienza dell'informazione" @@ -12,7 +12,7 @@ 1/0/8/ = "Pubblicazioni miscellanee, raccolte di citazioni" 1/0/9/ = "Bibliologia, manoscritti" -0/1/ = "Filosofia e discipline connesse" +0/1/ = "Filosofia e psicologia" 1/1/0/ = "Filosofia" 1/1/3/ = "Parapsicologia, occultismo" 1/1/5/ = "Psicologia" @@ -35,7 +35,7 @@ 1/3/8/ = "Commercio, comunicazione, trasporti" 1/3/9/ = "Folclore, tradizioni popolari, usi e costumi" -0/4/ = "Linguistica" +0/4/ = "Lingua" 1/4/0/ = "Lingua, linguistica" 1/4/2/ = "Inglese" 1/4/3/ = "Tedesco, lingue germaniche" @@ -46,7 +46,7 @@ 1/4/8/ = "Greco, greco moderno" 1/4/9/ = "Lingue slave, arabo, turco, altre lingue" -0/5/ = "Scienze pure" +0/5/ = "Scienze naturali e matematica" 1/5/0/ = "Scienze naturali" 1/5/1/ = "Matematica" 1/5/2/ = "Astronomia, cartografia" @@ -58,7 +58,7 @@ 1/5/8/ = "Botanica" 1/5/9/ = "Zoologia, biologia umana" -0/6/ = "Tecnologia" +0/6/ = "Tecnica, medicina, scienze applicate" 1/6/0/ = "Tecnica" 1/6/1/ = "Medicina, salute, farmacia" 1/6/2/ = "Ingegneria, ingegneria meccanica" @@ -69,7 +69,7 @@ 1/6/7/ = "Produzione industriale ed artigianale" 1/6/9/ = "Edilizia" -0/7/ = "Arti, belle arti e arti decorative" +0/7/ = "Arte e spettacolo" 1/7/0/ = "Le arti, le belle arti in generale" 1/7/1/ = "Architettura del paesaggio, pianificazione territoriale" 1/7/2/ = "Architettura" @@ -93,7 +93,7 @@ 1/8/8/ = "Letteratura greca classica e moderna" 1/8/9/ = "Letteratura slava, araba, turca, e in altre lingue" -0/9/ = "Geografia e storia +0/9/ = "Storia e geografia" 1/9/0/ = "Storia" 1/9/1/ = "Geografia, viaggi" 1/9/2/ = "Biografia, genealogia, araldica" diff --git a/local/languages/de.ini b/local/languages/de.ini index fdbc460f472..77813af3963 100644 --- a/local/languages/de.ini +++ b/local/languages/de.ini @@ -319,7 +319,6 @@ renew_select = "Verlängern" sort_author = "Verfasser" sort_title = "Titel" sort_relevance = "Relevanz" -subjectArea = "Fachbereich" summon_database_recommendations = "Weitere Ressourcen" external_access_info = "Sie befinden sich ausserhalb des Rechnernetzes der Universität Basel / Universität Bern. Der Zugriff auf die Volltexte von lizenzierten Produkten ist daher eingeschränkt. Als Angehörige der Universität Basel oder Bern aktivieren Sie bitte VPN" diff --git a/local/languages/en.ini b/local/languages/en.ini index a0f5036e297..8770aa53abe 100644 --- a/local/languages/en.ini +++ b/local/languages/en.ini @@ -318,7 +318,6 @@ renew_select = "Renew" sort_author = "Author" sort_title = "Title" sort_relevance = "Relevance" -subjectArea = "Fachbereich" summon_database_recommendations = "Additional resources" external_access_info = "Your IP address does not belong to the local network of the University Basel or University Bern. Access to full text may be restricted. Members of the University of Berne and Basel should connect by using their VPN client" diff --git a/local/languages/fr.ini b/local/languages/fr.ini index 88eb48df237..0f6cd2833e2 100644 --- a/local/languages/fr.ini +++ b/local/languages/fr.ini @@ -318,7 +318,6 @@ renew_select = "Prolonger" sort_author = "Auteur" sort_title = "Titre" sort_relevance = "Pertinence" -subjectArea = "Fachbereich" summon_database_recommendations = "Ressources supplémentaires" external_access_info = "Votre adresse IP est localisée au dehors des reseaux universitaires de Bâle ou de Berne. L'accès aux textes intégraux est limité. Les universitaires de Bâle ou de Berne doivent se connecter par le client VPN" diff --git a/local/languages/it.ini b/local/languages/it.ini index f896b1cf706..6b1f622d5d4 100644 --- a/local/languages/it.ini +++ b/local/languages/it.ini @@ -324,7 +324,6 @@ renew_select = "Prolungare" sort_author = "Autore" sort_title = "Titolo" sort_relevance = "Rilevanza" -subjectArea = "Fachbereich" summon_database_recommendations = "Altre risorse" external_access_info = "Your IP address does not belong to the local network of the University Basel or University Bern. Access to full text may be restricted. Members of the University of Berne and Basel should connect by using their VPN client" From 9ed9df08c458756d441c987778bf74a11f546f18 Mon Sep 17 00:00:00 2001 From: edelm Date: Thu, 11 Jul 2019 11:18:49 +0200 Subject: [PATCH 31/52] prevent error if holdings.ini does not contain all requested sections --- .../Swissbib/RecordDriver/Helper/Holdings.php | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/module/Swissbib/src/Swissbib/RecordDriver/Helper/Holdings.php b/module/Swissbib/src/Swissbib/RecordDriver/Helper/Holdings.php index db45e9c493f..3bd6cfc0b06 100644 --- a/module/Swissbib/src/Swissbib/RecordDriver/Helper/Holdings.php +++ b/module/Swissbib/src/Swissbib/RecordDriver/Helper/Holdings.php @@ -507,13 +507,15 @@ protected function initNetworks() */ $networkConfigs = $this->configHoldings->get($configName); - foreach ($networkConfigs as $networkCode => $networkConfig) { - list($domain, $library) = explode(',', $networkConfig, 2); - $this->networks[$networkCode] = [ - 'domain' => $domain, - 'library' => $library, - 'type' => $networkName, - ]; + if (!empty($networkConfig)) { + foreach ($networkConfigs as $networkCode => $networkConfig) { + list($domain, $library) = explode(',', $networkConfig, 2); + $this->networks[$networkCode] = [ + 'domain' => $domain, + 'library' => $library, + 'type' => $networkName, + ]; + } } } } From f19d27966f47e1de7ac30949d3a0869dc4ad8a06 Mon Sep 17 00:00:00 2001 From: Silvia Witzig Date: Thu, 11 Jul 2019 11:25:22 +0200 Subject: [PATCH 32/52] =?UTF-8?q?cleanup=20holdings.ini=20f=C3=BCr=20bb?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../c2sbmanually/config/vufind/Holdings.ini | 30 ++--------------- .../devbabe/config/vufind/Holdings.ini | 28 ++-------------- .../local/config/vufind/Holdings.ini | 33 ++----------------- .../productive/config/vufind/Holdings.ini | 27 ++------------- .../baselbern/test/config/vufind/Holdings.ini | 28 ++-------------- 5 files changed, 15 insertions(+), 131 deletions(-) diff --git a/local/baselbern/c2sbmanually/config/vufind/Holdings.ini b/local/baselbern/c2sbmanually/config/vufind/Holdings.ini index 5205dc83037..bc2dcfb4832 100644 --- a/local/baselbern/c2sbmanually/config/vufind/Holdings.ini +++ b/local/baselbern/c2sbmanually/config/vufind/Holdings.ini @@ -1,30 +1,6 @@ -[AlephNetworks] -IDSBB = http://aleph.unibas.ch,DSV01 -IDSSG = http://aleph.unisg.ch,HSB01 -IDSLU = http://ilu.zhbluzern.ch,ILU01 -NEBIS = http://opac.nebis.ch,EBI01 -SGBN = http://aleph.sg.ch,SGB01 -BGR = http://aleph.gr.ch,BGR01 -SBT = http://aleph.sbt.ti.ch,SBT01 -ABN = http://aleph.ag.ch,ABN01 -LIBIB = http://aleph.lbfl.li,LLB01 +[Parent_Config] +path = local/config/vufind/Holdings.ini ; true : API activated / false or unconfigured : API not activated [Restful] -IDSBB = true - -[Backlink] -ALEPH = "{server}/F?func=item-global&doc_library={bib-library-code}&doc_number={bib-system-number}&sub_library={aleph-sublibrary-code}" -ALEX = "http://www.alexandria.ch/primo_library/libweb/action/dlSearch.do?institution=BIG&vid=ALEX&scope=default_scope&query=any,contains,{bib-system-number}" -CCSA = "http://www.posters.nb.admin.ch/lib/item?id=chamo:{bib-system-number}" -CHARCH = "https://www.helveticarchives.ch/detail.aspx?ID={bib-system-number}" -IDSBB = "http://baselbern.swissbib.ch/Record/{id}?expandlib={sub-library-code}#holding-institution-{network}-{sub-library-code}" -IDSLU = "http://iluplus.hosted.exlibrisgroup.com/41ZBL:institution_scope:41ZBL_Aleph{bib-system-number}" -IDSSG = "{server}/php/bib_holdings.php?docnr={bib-system-number}" -IDSSGFH = "{server}/F?func=item-global&doc_library={bib-library-code}&doc_number={bib-system-number}&sub_library={aleph-sublibrary-code}&local_base=fhs" -IDSSGPH = "{server}/F?func=item-global&doc_library={bib-library-code}&doc_number={bib-system-number}&sub_library={aleph-sublibrary-code}&local_base=ph" -NEBIS = "https://recherche.nebis.ch/primo-explore/fulldisplay?docid=ebi01_prod{bib-system-number}&context=L&vid=NEBIS&search_scope=default_scope&tab=default_tab" -RERO = "http://opac.rero.ch/gateway?beginsrch=1&lng={language-code}&inst={RERO-network-code}&search=KEYWORD&function=INITREQ&fltset=submsn&t1={bib-system-number}&u1=12&floc={sub-library-code}0000" -SGBN = "http://sgbn-primo.hosted.exlibrisgroup.com/41STGKBG_VU1:41STGKBG-Lokal-PC:41STGKBG_ALEPH{bib-system-number}" -SNL = "http://www.helveticat.ch/lib/item?id=chamo:{bib-system-number}" -VAUD = "http://renouvaud.hosted.exlibrisgroup.com/primo_library/libweb/action/dlSearch.do?&institution=41BCULIB&vid=41BCULIB_VU1&search_scope=41BCULIB_ALMA_ALL&query=any,contains,{bib-system-number}" \ No newline at end of file +IDSBB = true \ No newline at end of file diff --git a/local/baselbern/devbabe/config/vufind/Holdings.ini b/local/baselbern/devbabe/config/vufind/Holdings.ini index 9d5628395e0..bc2dcfb4832 100644 --- a/local/baselbern/devbabe/config/vufind/Holdings.ini +++ b/local/baselbern/devbabe/config/vufind/Holdings.ini @@ -1,28 +1,6 @@ -[AlephNetworks] -IDSBB = http://aleph.unibas.ch,DSV01 -IDSSG = http://aleph.unisg.ch,HSB01 -IDSLU = http://ilu.zhbluzern.ch,ILU01 -NEBIS = http://opac.nebis.ch,EBI01 -SGBN = http://aleph.sg.ch,SGB01 -BGR = http://aleph.gr.ch,BGR01 -SBT = http://aleph.sbt.ti.ch,SBT01 -ABN = http://aleph.ag.ch,ABN01 -LIBIB = http://aleph.lbfl.li,LLB01 +[Parent_Config] +path = local/config/vufind/Holdings.ini ; true : API activated / false or unconfigured : API not activated [Restful] -IDSBB = true - -[Backlink] -ALEPH = "{server}/F?func=item-global&doc_library={bib-library-code}&doc_number={bib-system-number}&sub_library={aleph-sublibrary-code}" -ALEX = "http://www.alexandria.ch/primo_library/libweb/action/dlSearch.do?institution=BIG&vid=ALEX&scope=default_scope&query=any,contains,{bib-system-number}" -CCSA = "http://www.posters.nb.admin.ch/lib/item?id=chamo:{bib-system-number}" -CHARCH = "https://www.helveticarchives.ch/detail.aspx?ID={bib-system-number}" -IDSBB = "http://baselbern.swissbib.ch/Record/{id}?expandlib={sub-library-code}#holding-institution-{network}-{sub-library-code}" -IDSLU = "http://iluplus.hosted.exlibrisgroup.com/41ZBL:institution_scope:41ZBL_Aleph{bib-system-number}" -IDSSG = "{server}/php/bib_holdings.php?docnr={bib-system-number}" -IDSSGFH = "{server}/F?func=item-global&doc_library={bib-library-code}&doc_number={bib-system-number}&sub_library={aleph-sublibrary-code}&local_base=fhs" -IDSSGPH = "{server}/F?func=item-global&doc_library={bib-library-code}&doc_number={bib-system-number}&sub_library={aleph-sublibrary-code}&local_base=ph" -NEBIS = "https://recherche.nebis.ch/primo-explore/fulldisplay?docid=ebi01_prod{bib-system-number}&context=L&vid=NEBIS&search_scope=default_scope&tab=default_tab" -RERO = "http://opac.rero.ch/gateway?beginsrch=1&lng={language-code}&inst={RERO-network-code}&search=KEYWORD&function=INITREQ&fltset=submsn&t1={bib-system-number}&u1=12&floc={sub-library-code}0000" -SNL = "https://nb-helveticat.primo.exlibrisgroup.com/discovery/fulldisplay?docid=alma{bib-system-number}&context=L&vid=41SNL_51_INST:helveticat&search_scope=MyInstitution&tab=LibraryCatalog" \ No newline at end of file +IDSBB = true \ No newline at end of file diff --git a/local/baselbern/local/config/vufind/Holdings.ini b/local/baselbern/local/config/vufind/Holdings.ini index 44ffcf790ec..bc2dcfb4832 100644 --- a/local/baselbern/local/config/vufind/Holdings.ini +++ b/local/baselbern/local/config/vufind/Holdings.ini @@ -1,33 +1,6 @@ -[AlephNetworks] -IDSBB = http://aleph.unibas.ch,DSV01 -IDSSG = http://aleph.unisg.ch,HSB01 -IDSLU = http://ilu.zhbluzern.ch,ILU01 -NEBIS = http://opac.nebis.ch,EBI01 -SGBN = http://aleph.sg.ch,SGB01 -BGR = http://aleph.gr.ch,BGR01 -SBT = http://aleph.sbt.ti.ch,SBT01 -ABN = http://aleph.ag.ch,ABN01 -LIBIB = http://aleph.lbfl.li,LLB01 - -[SpecialNetworks] -RERO = https://services.test.rero.ch,RERO +[Parent_Config] +path = local/config/vufind/Holdings.ini ; true : API activated / false or unconfigured : API not activated [Restful] -IDSBB = true - -[Backlink] -ALEPH = "{server}/F?func=item-global&doc_library={bib-library-code}&doc_number={bib-system-number}&sub_library={aleph-sublibrary-code}" -ALEX = "http://www.alexandria.ch/primo_library/libweb/action/dlSearch.do?institution=BIG&vid=ALEX&scope=default_scope&query=any,contains,{bib-system-number}" -CCSA = "http://www.posters.nb.admin.ch/lib/item?id=chamo:{bib-system-number}" -CHARCH = "https://www.helveticarchives.ch/detail.aspx?ID={bib-system-number}" -IDSBB = "http://baselbern.swissbib.ch/Record/{id}?expandlib={sub-library-code}#holding-institution-{network}-{sub-library-code}" -IDSLU = "http://iluplus.hosted.exlibrisgroup.com/41ZBL:institution_scope:41ZBL_Aleph{bib-system-number}" -IDSSG = "{server}/php/bib_holdings.php?docnr={bib-system-number}" -IDSSGFH = "{server}/F?func=item-global&doc_library={bib-library-code}&doc_number={bib-system-number}&sub_library={aleph-sublibrary-code}&local_base=fhs" -IDSSGPH = "{server}/F?func=item-global&doc_library={bib-library-code}&doc_number={bib-system-number}&sub_library={aleph-sublibrary-code}&local_base=ph" -NEBIS = "https://recherche.nebis.ch/primo-explore/fulldisplay?docid=ebi01_prod{bib-system-number}&context=L&vid=NEBIS&search_scope=default_scope&tab=default_tab" -RERO = "http://opac.rero.ch/gateway?beginsrch=1&lng={language-code}&inst={RERO-network-code}&search=KEYWORD&function=INITREQ&fltset=submsn&t1={bib-system-number}&u1=12&floc={sub-library-code}0000" -SGBN = "http://sgbn-primo.hosted.exlibrisgroup.com/41STGKBG_VU1:41STGKBG-Lokal-PC:41STGKBG_ALEPH{bib-system-number}" -SNL = "https://nb-helveticat.primo.exlibrisgroup.com/discovery/fulldisplay?docid=alma{bib-system-number}&context=L&vid=41SNL_51_INST:helveticat&search_scope=MyInstitution&tab=LibraryCatalog" -VAUD = "http://renouvaud.hosted.exlibrisgroup.com/primo_library/libweb/action/dlSearch.do?&institution=41BCULIB&vid=41BCULIB_VU1&search_scope=41BCULIB_ALMA_ALL&query=any,contains,{bib-system-number}" \ No newline at end of file +IDSBB = true \ No newline at end of file diff --git a/local/baselbern/productive/config/vufind/Holdings.ini b/local/baselbern/productive/config/vufind/Holdings.ini index a2c9a571628..bc2dcfb4832 100644 --- a/local/baselbern/productive/config/vufind/Holdings.ini +++ b/local/baselbern/productive/config/vufind/Holdings.ini @@ -1,27 +1,6 @@ -[AlephNetworks] -IDSBB = http://aleph.unibas.ch,DSV01 -IDSSG = http://aleph.unisg.ch,HSB01 -IDSSG2 = http://aleph.unisg.ch,HSB02 -IDSLU = http://ilu.zhbluzern.ch,ILU01 -NEBIS = http://opac.nebis.ch,EBI01 -SGBN = http://aleph.sg.ch,SGB01 -BGR = http://aleph.gr.ch,BGR01 -SBT = http://aleph.sbt.ti.ch,SBT01 -ABN = http://aleph.ag.ch,ABN01 -LIBIB = http://aleph.lbfl.li,LLB01 +[Parent_Config] +path = local/config/vufind/Holdings.ini ; true : API activated / false or unconfigured : API not activated [Restful] -IDSBB = true - -[Backlink] -ALEPH = "{server}/F?func=item-global&doc_library={bib-library-code}&doc_number={bib-system-number}&sub_library={aleph-sublibrary-code}" -ALEX = "http://www.alexandria.ch/primo_library/libweb/action/dlSearch.do?institution=BIG&vid=ALEX&scope=default_scope&query=lsr07,contains,vtls{bib-system-number}-41big_inst" -CCSA = "http://www.posters.nb.admin.ch/lib/item?id=chamo:{bib-system-number}" -CHARCH = "https://www.helveticarchives.ch/detail.aspx?ID={bib-system-number}" -IDSBB = "http://baselbern.swissbib.ch/Record/{id}?expandlib={sub-library-code}#holding-institution-{network}-{sub-library-code}" -;IDSLU = "http://iluplus.hosted.exlibrisgroup.com/41ZBL:institution_scope:41ZBL_Aleph{bib-system-number}" -IDSSG = "{server}/php/bib_holdings.php?docnr={bib-system-number}" -NEBIS = "https://recherche.nebis.ch/primo-explore/fulldisplay?docid=ebi01_prod{bib-system-number}&context=L&vid=NEBIS&search_scope=default_scope&tab=default_tab" -RERO = "http://opac.rero.ch/gateway?beginsrch=1&lng={language-code}&inst={RERO-network-code}&search=KEYWORD&function=INITREQ&fltset=submsn&t1={bib-system-number}&u1=12&floc={sub-library-code}0000" -SNL = "https://nb-helveticat.primo.exlibrisgroup.com/discovery/fulldisplay?docid=alma{bib-system-number}&context=L&vid=41SNL_51_INST:helveticat&search_scope=MyInstitution&tab=LibraryCatalog" \ No newline at end of file +IDSBB = true \ No newline at end of file diff --git a/local/baselbern/test/config/vufind/Holdings.ini b/local/baselbern/test/config/vufind/Holdings.ini index 9d5628395e0..bc2dcfb4832 100644 --- a/local/baselbern/test/config/vufind/Holdings.ini +++ b/local/baselbern/test/config/vufind/Holdings.ini @@ -1,28 +1,6 @@ -[AlephNetworks] -IDSBB = http://aleph.unibas.ch,DSV01 -IDSSG = http://aleph.unisg.ch,HSB01 -IDSLU = http://ilu.zhbluzern.ch,ILU01 -NEBIS = http://opac.nebis.ch,EBI01 -SGBN = http://aleph.sg.ch,SGB01 -BGR = http://aleph.gr.ch,BGR01 -SBT = http://aleph.sbt.ti.ch,SBT01 -ABN = http://aleph.ag.ch,ABN01 -LIBIB = http://aleph.lbfl.li,LLB01 +[Parent_Config] +path = local/config/vufind/Holdings.ini ; true : API activated / false or unconfigured : API not activated [Restful] -IDSBB = true - -[Backlink] -ALEPH = "{server}/F?func=item-global&doc_library={bib-library-code}&doc_number={bib-system-number}&sub_library={aleph-sublibrary-code}" -ALEX = "http://www.alexandria.ch/primo_library/libweb/action/dlSearch.do?institution=BIG&vid=ALEX&scope=default_scope&query=any,contains,{bib-system-number}" -CCSA = "http://www.posters.nb.admin.ch/lib/item?id=chamo:{bib-system-number}" -CHARCH = "https://www.helveticarchives.ch/detail.aspx?ID={bib-system-number}" -IDSBB = "http://baselbern.swissbib.ch/Record/{id}?expandlib={sub-library-code}#holding-institution-{network}-{sub-library-code}" -IDSLU = "http://iluplus.hosted.exlibrisgroup.com/41ZBL:institution_scope:41ZBL_Aleph{bib-system-number}" -IDSSG = "{server}/php/bib_holdings.php?docnr={bib-system-number}" -IDSSGFH = "{server}/F?func=item-global&doc_library={bib-library-code}&doc_number={bib-system-number}&sub_library={aleph-sublibrary-code}&local_base=fhs" -IDSSGPH = "{server}/F?func=item-global&doc_library={bib-library-code}&doc_number={bib-system-number}&sub_library={aleph-sublibrary-code}&local_base=ph" -NEBIS = "https://recherche.nebis.ch/primo-explore/fulldisplay?docid=ebi01_prod{bib-system-number}&context=L&vid=NEBIS&search_scope=default_scope&tab=default_tab" -RERO = "http://opac.rero.ch/gateway?beginsrch=1&lng={language-code}&inst={RERO-network-code}&search=KEYWORD&function=INITREQ&fltset=submsn&t1={bib-system-number}&u1=12&floc={sub-library-code}0000" -SNL = "https://nb-helveticat.primo.exlibrisgroup.com/discovery/fulldisplay?docid=alma{bib-system-number}&context=L&vid=41SNL_51_INST:helveticat&search_scope=MyInstitution&tab=LibraryCatalog" \ No newline at end of file +IDSBB = true \ No newline at end of file From 78a625a918613d53f620361dac1b5e12fba0931a Mon Sep 17 00:00:00 2001 From: Lionel Walter Date: Thu, 11 Jul 2019 11:34:24 +0200 Subject: [PATCH 33/52] adjust debugging solr links, so that they handle post request as well --- .../src/VuFindSearch/Backend/Solr/Connector.php | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/module/VuFindSearch/src/VuFindSearch/Backend/Solr/Connector.php b/module/VuFindSearch/src/VuFindSearch/Backend/Solr/Connector.php index 6f567a2af7d..d8d0ed4b16f 100644 --- a/module/VuFindSearch/src/VuFindSearch/Backend/Solr/Connector.php +++ b/module/VuFindSearch/src/VuFindSearch/Backend/Solr/Connector.php @@ -362,6 +362,15 @@ public function query($handler, ParamBag $params) } $this->debug(sprintf('Query %s', $paramString)); + + //useful to display links to solr queries directly on screen + /* + echo 'solr link'; + */ + return $this->trySolrUrls($method, $urlSuffix, $callback); } @@ -449,14 +458,6 @@ protected function trySolrUrls($method, $urlSuffix, $callback = null) */ protected function send(HttpClient $client) { - //useful to display links to solr queries directly on screen - /* - echo 'solr link'; - */ - $this->debug( sprintf('=> %s %s', $client->getMethod(), $client->getUri()) ); From 9b430c992cef015773714bac86fc82b3a276849f Mon Sep 17 00:00:00 2001 From: Silvia Witzig Date: Thu, 11 Jul 2019 11:36:17 +0200 Subject: [PATCH 34/52] cleanup Holdings.ini bb --- .../c2sbmanually/config/vufind/Holdings.ini | 6 +-- .../devbabe/config/vufind/Holdings.ini | 6 +-- .../local/config/vufind/Holdings.ini | 6 +-- .../productive/config/vufind/Holdings.ini | 39 +++++++++++++++++-- .../baselbern/test/config/vufind/Holdings.ini | 6 +-- 5 files changed, 40 insertions(+), 23 deletions(-) diff --git a/local/baselbern/c2sbmanually/config/vufind/Holdings.ini b/local/baselbern/c2sbmanually/config/vufind/Holdings.ini index bc2dcfb4832..550ded02d54 100644 --- a/local/baselbern/c2sbmanually/config/vufind/Holdings.ini +++ b/local/baselbern/c2sbmanually/config/vufind/Holdings.ini @@ -1,6 +1,2 @@ [Parent_Config] -path = local/config/vufind/Holdings.ini - -; true : API activated / false or unconfigured : API not activated -[Restful] -IDSBB = true \ No newline at end of file +path = local/baselbern/productive/config/vufind/Holdings.ini \ No newline at end of file diff --git a/local/baselbern/devbabe/config/vufind/Holdings.ini b/local/baselbern/devbabe/config/vufind/Holdings.ini index bc2dcfb4832..550ded02d54 100644 --- a/local/baselbern/devbabe/config/vufind/Holdings.ini +++ b/local/baselbern/devbabe/config/vufind/Holdings.ini @@ -1,6 +1,2 @@ [Parent_Config] -path = local/config/vufind/Holdings.ini - -; true : API activated / false or unconfigured : API not activated -[Restful] -IDSBB = true \ No newline at end of file +path = local/baselbern/productive/config/vufind/Holdings.ini \ No newline at end of file diff --git a/local/baselbern/local/config/vufind/Holdings.ini b/local/baselbern/local/config/vufind/Holdings.ini index bc2dcfb4832..550ded02d54 100644 --- a/local/baselbern/local/config/vufind/Holdings.ini +++ b/local/baselbern/local/config/vufind/Holdings.ini @@ -1,6 +1,2 @@ [Parent_Config] -path = local/config/vufind/Holdings.ini - -; true : API activated / false or unconfigured : API not activated -[Restful] -IDSBB = true \ No newline at end of file +path = local/baselbern/productive/config/vufind/Holdings.ini \ No newline at end of file diff --git a/local/baselbern/productive/config/vufind/Holdings.ini b/local/baselbern/productive/config/vufind/Holdings.ini index bc2dcfb4832..cffb05e4118 100644 --- a/local/baselbern/productive/config/vufind/Holdings.ini +++ b/local/baselbern/productive/config/vufind/Holdings.ini @@ -1,6 +1,39 @@ -[Parent_Config] -path = local/config/vufind/Holdings.ini +[AlephNetworks] +IDSBB = http://aleph.unibas.ch,DSV01 +IDSSG = http://aleph.unisg.ch,HSB01 +IDSLU = http://ilu.zhbluzern.ch,ILU01 +NEBIS = http://opac.nebis.ch,EBI01 +SGBN = http://aleph.sg.ch,SGB01 +BGR = http://aleph.gr.ch,BGR01 +SBT = http://aleph.sbt.ti.ch,SBT01 +ABN = http://aleph.ag.ch,ABN01 +LIBIB = http://aleph.lbfl.li,LLB01 + +[SpecialNetworks] +RERO = https://services.test.rero.ch,RERO ; true : API activated / false or unconfigured : API not activated [Restful] -IDSBB = true \ No newline at end of file +IDSBB = true + +[Backlink] +ABN = "https://abn-primo.hosted.exlibrisgroup.com/primo-explore/fulldisplay?docid=41ABN_ALEPH_DS{bib-system-number}&context=L&vid=41ABN_VU1&search_scope=ABN51&tab=default_tab" +ALEPH = "{server}/F?func=item-global&doc_library={bib-library-code}&doc_number={bib-system-number}&sub_library={aleph-sublibrary-code}" +ALEX = "https://www.alexandria.ch/primo-explore/search?query=any,contains,{bib-system-number}&sortby=rank&vid=ALEX" +BISCH = "https://webopac.bibliotheken-schaffhausen.ch/TouchPoint_touchpoint/perma.do?q=0%3D%22{bib-system-number}%22+IN+%5B2%5D&v=extern&l=de" +CEO = "https://library.olympic.org/Default/doc/SYRACUSE/{bib-system-number}/" +CHARCH = "https://www.helveticarchives.ch/detail.aspx?ID={bib-system-number}" +HEMU = "http://opacbiblio.hemu-cl.ch/cgi-bin/koha/opac-detail.pl?biblionumber={bib-system-number}" +IDSBB = "http://baselbern.swissbib.ch/Record/{id}?expandlib={sub-library-code}#holding-institution-{network}-{sub-library-code}" +IDSLU = "http://iluplus.hosted.exlibrisgroup.com/41ZBL:institution_scope:41ZBL_Aleph{bib-system-number}" +IDSSG = "{server}/php/bib_holdings.php?docnr={bib-system-number}" +IDSSGFH = "{server}/F?func=item-global&doc_library={bib-library-code}&doc_number={bib-system-number}&sub_library={aleph-sublibrary-code}&local_base=fhs" +IDSSGPH = "{server}/F?func=item-global&doc_library={bib-library-code}&doc_number={bib-system-number}&sub_library={aleph-sublibrary-code}&local_base=ph" +NEBIS = "https://recherche.nebis.ch/primo-explore/fulldisplay?docid=ebi01_prod{bib-system-number}&context=L&vid=NEBIS&search_scope=default_scope&tab=default_tab" +KBTG = "http://netbiblio.tg.ch/kbtg/search/notice?noticeID={bib-system-number}" +RERO = "http://data.rero.ch/01-{bib-system-number}/html?view={RERO-network}_V1" +SGBN = "https://sgbn-primo.hosted.exlibrisgroup.com/primo-explore/fulldisplay?docid=41STGKBG_ALEPH{bib-system-number}&context=L&vid=41STGKBG_VU1&search_scope=41STGKBG-Lokal-PC&tab=default_tab&lang=de_DE" +VAUD = "https://renouvaud.hosted.exlibrisgroup.com/primo-explore/search?vid=41BCULIB_VU2&search_scope=41BCULIB_ALMA_ALL&query=any,contains,{bib-system-number}&sortby=rank" +VAUDS = "https://renouvaud.hosted.exlibrisgroup.com/primo-explore/search?vid=41BCULIB_VU2&search_scope=41BCULIB_ALMA_ALL&query=any,contains,{bib-system-number}&sortby=rank" +CCSA = "https://nb-posters.primo.exlibrisgroup.com/discovery/fulldisplay?docid=alma{bib-system-number}&context=L&vid=41SNL_53_INST:posters&search_scope=MyInstitution&tab=LibraryCatalog" +SNL = "https://nb-helveticat.primo.exlibrisgroup.com/discovery/fulldisplay?docid=alma{bib-system-number}&context=L&vid=41SNL_51_INST:helveticat&search_scope=MyInstitution&tab=LibraryCatalog" \ No newline at end of file diff --git a/local/baselbern/test/config/vufind/Holdings.ini b/local/baselbern/test/config/vufind/Holdings.ini index bc2dcfb4832..550ded02d54 100644 --- a/local/baselbern/test/config/vufind/Holdings.ini +++ b/local/baselbern/test/config/vufind/Holdings.ini @@ -1,6 +1,2 @@ [Parent_Config] -path = local/config/vufind/Holdings.ini - -; true : API activated / false or unconfigured : API not activated -[Restful] -IDSBB = true \ No newline at end of file +path = local/baselbern/productive/config/vufind/Holdings.ini \ No newline at end of file From ec386b130dd9af014f5280696134fc407ae9e157 Mon Sep 17 00:00:00 2001 From: Demian Katz Date: Wed, 10 Jul 2019 13:40:28 -0400 Subject: [PATCH 35/52] Simplify diacritic removal with Transliterator object. --- .../src/VuFindSearch/Query/Query.php | 115 ++---------------- 1 file changed, 8 insertions(+), 107 deletions(-) diff --git a/module/VuFindSearch/src/VuFindSearch/Query/Query.php b/module/VuFindSearch/src/VuFindSearch/Query/Query.php index 2e61caae859..daf6b64e8ea 100644 --- a/module/VuFindSearch/src/VuFindSearch/Query/Query.php +++ b/module/VuFindSearch/src/VuFindSearch/Query/Query.php @@ -285,118 +285,19 @@ public function replaceTermIgnoringAccents($from, $to) /** * Remove accents and umlauts from a string - * (a better alternative might be to use iconv library) - * from https://stackoverflow.com/questions/1017599 * * @param string $string The text where we would like to remove accents * - * @return string The input text with accents removed + * @return string The input text with accents removed */ protected function stripDiacritics($string) { - if (!preg_match('/[\x80-\xff]/', $string)) { - return $string; - } - - $chars = [ - // Decompositions for Latin-1 Supplement - chr(195) . chr(128) => 'A', chr(195) . chr(129) => 'A', - chr(195) . chr(130) => 'A', chr(195) . chr(131) => 'A', - chr(195) . chr(132) => 'A', chr(195) . chr(133) => 'A', - chr(195) . chr(135) => 'C', chr(195) . chr(136) => 'E', - chr(195) . chr(137) => 'E', chr(195) . chr(138) => 'E', - chr(195) . chr(139) => 'E', chr(195) . chr(140) => 'I', - chr(195) . chr(141) => 'I', chr(195) . chr(142) => 'I', - chr(195) . chr(143) => 'I', chr(195) . chr(145) => 'N', - chr(195) . chr(146) => 'O', chr(195) . chr(147) => 'O', - chr(195) . chr(148) => 'O', chr(195) . chr(149) => 'O', - chr(195) . chr(150) => 'O', chr(195) . chr(153) => 'U', - chr(195) . chr(154) => 'U', chr(195) . chr(155) => 'U', - chr(195) . chr(156) => 'U', chr(195) . chr(157) => 'Y', - chr(195) . chr(159) => 's', chr(195) . chr(160) => 'a', - chr(195) . chr(161) => 'a', chr(195) . chr(162) => 'a', - chr(195) . chr(163) => 'a', chr(195) . chr(164) => 'a', - chr(195) . chr(165) => 'a', chr(195) . chr(167) => 'c', - chr(195) . chr(168) => 'e', chr(195) . chr(169) => 'e', - chr(195) . chr(170) => 'e', chr(195) . chr(171) => 'e', - chr(195) . chr(172) => 'i', chr(195) . chr(173) => 'i', - chr(195) . chr(174) => 'i', chr(195) . chr(175) => 'i', - chr(195) . chr(177) => 'n', chr(195) . chr(178) => 'o', - chr(195) . chr(179) => 'o', chr(195) . chr(180) => 'o', - chr(195) . chr(181) => 'o', chr(195) . chr(182) => 'o', - chr(195) . chr(182) => 'o', chr(195) . chr(185) => 'u', - chr(195) . chr(186) => 'u', chr(195) . chr(187) => 'u', - chr(195) . chr(188) => 'u', chr(195) . chr(189) => 'y', - chr(195) . chr(191) => 'y', - // Decompositions for Latin Extended-A - chr(196) . chr(128) => 'A', chr(196) . chr(129) => 'a', - chr(196) . chr(130) => 'A', chr(196) . chr(131) => 'a', - chr(196) . chr(132) => 'A', chr(196) . chr(133) => 'a', - chr(196) . chr(134) => 'C', chr(196) . chr(135) => 'c', - chr(196) . chr(136) => 'C', chr(196) . chr(137) => 'c', - chr(196) . chr(138) => 'C', chr(196) . chr(139) => 'c', - chr(196) . chr(140) => 'C', chr(196) . chr(141) => 'c', - chr(196) . chr(142) => 'D', chr(196) . chr(143) => 'd', - chr(196) . chr(144) => 'D', chr(196) . chr(145) => 'd', - chr(196) . chr(146) => 'E', chr(196) . chr(147) => 'e', - chr(196) . chr(148) => 'E', chr(196) . chr(149) => 'e', - chr(196) . chr(150) => 'E', chr(196) . chr(151) => 'e', - chr(196) . chr(152) => 'E', chr(196) . chr(153) => 'e', - chr(196) . chr(154) => 'E', chr(196) . chr(155) => 'e', - chr(196) . chr(156) => 'G', chr(196) . chr(157) => 'g', - chr(196) . chr(158) => 'G', chr(196) . chr(159) => 'g', - chr(196) . chr(160) => 'G', chr(196) . chr(161) => 'g', - chr(196) . chr(162) => 'G', chr(196) . chr(163) => 'g', - chr(196) . chr(164) => 'H', chr(196) . chr(165) => 'h', - chr(196) . chr(166) => 'H', chr(196) . chr(167) => 'h', - chr(196) . chr(168) => 'I', chr(196) . chr(169) => 'i', - chr(196) . chr(170) => 'I', chr(196) . chr(171) => 'i', - chr(196) . chr(172) => 'I', chr(196) . chr(173) => 'i', - chr(196) . chr(174) => 'I', chr(196) . chr(175) => 'i', - chr(196) . chr(176) => 'I', chr(196) . chr(177) => 'i', - chr(196) . chr(178) => 'IJ',chr(196) . chr(179) => 'ij', - chr(196) . chr(180) => 'J', chr(196) . chr(181) => 'j', - chr(196) . chr(182) => 'K', chr(196) . chr(183) => 'k', - chr(196) . chr(184) => 'k', chr(196) . chr(185) => 'L', - chr(196) . chr(186) => 'l', chr(196) . chr(187) => 'L', - chr(196) . chr(188) => 'l', chr(196) . chr(189) => 'L', - chr(196) . chr(190) => 'l', chr(196) . chr(191) => 'L', - chr(197) . chr(128) => 'l', chr(197) . chr(129) => 'L', - chr(197) . chr(130) => 'l', chr(197) . chr(131) => 'N', - chr(197) . chr(132) => 'n', chr(197) . chr(133) => 'N', - chr(197) . chr(134) => 'n', chr(197) . chr(135) => 'N', - chr(197) . chr(136) => 'n', chr(197) . chr(137) => 'N', - chr(197) . chr(138) => 'n', chr(197) . chr(139) => 'N', - chr(197) . chr(140) => 'O', chr(197) . chr(141) => 'o', - chr(197) . chr(142) => 'O', chr(197) . chr(143) => 'o', - chr(197) . chr(144) => 'O', chr(197) . chr(145) => 'o', - chr(197) . chr(146) => 'OE',chr(197) . chr(147) => 'oe', - chr(197) . chr(148) => 'R',chr(197) . chr(149) => 'r', - chr(197) . chr(150) => 'R',chr(197) . chr(151) => 'r', - chr(197) . chr(152) => 'R',chr(197) . chr(153) => 'r', - chr(197) . chr(154) => 'S',chr(197) . chr(155) => 's', - chr(197) . chr(156) => 'S',chr(197) . chr(157) => 's', - chr(197) . chr(158) => 'S',chr(197) . chr(159) => 's', - chr(197) . chr(160) => 'S', chr(197) . chr(161) => 's', - chr(197) . chr(162) => 'T', chr(197) . chr(163) => 't', - chr(197) . chr(164) => 'T', chr(197) . chr(165) => 't', - chr(197) . chr(166) => 'T', chr(197) . chr(167) => 't', - chr(197) . chr(168) => 'U', chr(197) . chr(169) => 'u', - chr(197) . chr(170) => 'U', chr(197) . chr(171) => 'u', - chr(197) . chr(172) => 'U', chr(197) . chr(173) => 'u', - chr(197) . chr(174) => 'U', chr(197) . chr(175) => 'u', - chr(197) . chr(176) => 'U', chr(197) . chr(177) => 'u', - chr(197) . chr(178) => 'U', chr(197) . chr(179) => 'u', - chr(197) . chr(180) => 'W', chr(197) . chr(181) => 'w', - chr(197) . chr(182) => 'Y', chr(197) . chr(183) => 'y', - chr(197) . chr(184) => 'Y', chr(197) . chr(185) => 'Z', - chr(197) . chr(186) => 'z', chr(197) . chr(187) => 'Z', - chr(197) . chr(188) => 'z', chr(197) . chr(189) => 'Z', - chr(197) . chr(190) => 'z', chr(197) . chr(191) => 's' - ]; - - $string = strtr($string, $chars); - - return $string; + // See http://userguide.icu-project.org/transforms/general for + // an explanation of this. + $transliterator = \Transliterator::createFromRules( + ':: NFD; :: [:Nonspacing Mark:] Remove; :: NFC;', + \Transliterator::FORWARD + ); + return $transliterator->transliterate($string); } } From 6a22724317076c938a6e7489d7a792ba99c6c4e5 Mon Sep 17 00:00:00 2001 From: Demian Katz Date: Wed, 10 Jul 2019 13:54:20 -0400 Subject: [PATCH 36/52] Code simplification. --- .../src/VuFind/Search/UrlQueryHelper.php | 20 +++---- .../src/VuFind/View/Helper/AbstractSearch.php | 2 - .../src/VuFindSearch/Query/Query.php | 54 ++++++++----------- .../src/VuFindSearch/Query/QueryGroup.php | 25 +++------ 4 files changed, 35 insertions(+), 66 deletions(-) diff --git a/module/VuFind/src/VuFind/Search/UrlQueryHelper.php b/module/VuFind/src/VuFind/Search/UrlQueryHelper.php index cb2673b3740..50e375f9c26 100644 --- a/module/VuFind/src/VuFind/Search/UrlQueryHelper.php +++ b/module/VuFind/src/VuFind/Search/UrlQueryHelper.php @@ -237,24 +237,16 @@ public function __toString() /** * Replace a term in the search query (used for spelling replacement) * - * @param string $from Search term to find - * @param string $to Search term to insert - * @param boolean $ignoreCase If we should ignore the case differences - * when replacing - * @param boolean $ignoreDiacritics If we should ignore the diacritics when - * replacing, i.e. if $from is durenmatt, - * it could replace dürenmatt in the query + * @param string $from Search term to find + * @param string $to Search term to insert + * @param boolean $normalize If we should apply text normalization when replacing * * @return UrlQueryHelper */ - public function replaceTerm( - $from, - $to, - $ignoreCase = false, - $ignoreDiacritics = false - ) { + public function replaceTerm($from, $to, $normalize = false) + { $query = clone $this->queryObject; - $query->replaceTerm($from, $to, $ignoreCase, $ignoreDiacritics); + $query->replaceTerm($from, $to, $normalize); return new static($this->urlParams, $query, $this->config); } diff --git a/module/VuFind/src/VuFind/View/Helper/AbstractSearch.php b/module/VuFind/src/VuFind/View/Helper/AbstractSearch.php index e76ba258c82..c2b585b2aad 100644 --- a/module/VuFind/src/VuFind/View/Helper/AbstractSearch.php +++ b/module/VuFind/src/VuFind/View/Helper/AbstractSearch.php @@ -87,7 +87,6 @@ public function renderSpellingSuggestions($msg, $results, $view) ->replaceTerm( $term, $data['new_term'], - true, true )->getParams(); $html .= '' . $view->escapeHtml($word) @@ -97,7 +96,6 @@ public function renderSpellingSuggestions($msg, $results, $view) ->replaceTerm( $term, $data['expand_term'], - true, true )->getParams(); $html .= $this->renderExpandLink($url, $view); diff --git a/module/VuFindSearch/src/VuFindSearch/Query/Query.php b/module/VuFindSearch/src/VuFindSearch/Query/Query.php index daf6b64e8ea..832a1527d30 100644 --- a/module/VuFindSearch/src/VuFindSearch/Query/Query.php +++ b/module/VuFindSearch/src/VuFindSearch/Query/Query.php @@ -84,6 +84,18 @@ public function getString() return $this->queryString; } + /** + * Apply normalization to a string. + * + * @param string $text String to normalize. + * + * @return string + */ + protected function normalizeText($text) + { + return strtolower($this->stripDiacritics($text)); + } + /** * Return search string without accents and umlauts * @@ -91,7 +103,7 @@ public function getString() */ public function getNormalizedString() { - return strtolower($this->stripDiacritics($this->queryString)); + return $this->normalizeText($this->queryString); } /** @@ -179,13 +191,10 @@ public function containsNormalizedTerm($needle) { // Escape characters with special meaning in regular expressions to avoid // errors: - $needle = preg_quote($needle, '/'); - - $needle = strtolower($this->stripDiacritics($needle)); + $needle = preg_quote($this->normalizeText($needle), '/'); return (bool)preg_match( - "/\b$needle\b/u", - strtolower($this->stripDiacritics($this->getString())) + "/\b$needle\b/u", $this->getNormalizedString() ); } @@ -202,36 +211,19 @@ public function getAllTerms() /** * Replace a term. * - * @param string $from Search term to find - * @param string $to Search term to insert - * @param boolean $ignoreCase If we should ignore the case differences - * when replacing - * @param boolean $ignoreDiacritics If we should ignore the diacritics when - * replacing, i.e. if $from is durenmatt, - * it could replace dürenmatt in the query + * @param string $from Search term to find + * @param string $to Search term to insert + * @param boolean $normalize If we should apply text normalization when replacing * * @return void */ - public function replaceTerm( - $from, - $to, - $ignoreCase = false, - $ignoreDiacritics = false - ) { + public function replaceTerm($from, $to, $normalize = false) + { // Escape $from so it is regular expression safe (just in case it // includes any weird punctuation -- unlikely but possible): - $from = preg_quote($from, '/'); - $queryString = $this->queryString; - - if ($ignoreCase) { - $from = strtolower($from); - $queryString = strtolower($queryString); - } - - if ($ignoreDiacritics) { - $from = $this->stripDiacritics($from); - $queryString = $this->stripDiacritics($queryString); - } + $from = preg_quote($normalize ? $this->normalizeText($from) : $from, '/'); + $queryString = $normalize + ? $this->getNormalizedString() : $this->queryString; // If our "from" pattern contains non-word characters, we can't use word // boundaries for matching. We want to try to use word boundaries when diff --git a/module/VuFindSearch/src/VuFindSearch/Query/QueryGroup.php b/module/VuFindSearch/src/VuFindSearch/Query/QueryGroup.php index f2d6856f3a9..067e11fcc08 100644 --- a/module/VuFindSearch/src/VuFindSearch/Query/QueryGroup.php +++ b/module/VuFindSearch/src/VuFindSearch/Query/QueryGroup.php @@ -288,29 +288,16 @@ public function getAllTerms() /** * Replace a term. * - * @param string $from Search term to find - * @param string $to Search term to insert - * @param boolean $ignoreCase If we should ignore the case differences - * when replacing - * @param boolean $ignoreDiacritics If we should ignore the diacritics when - * replacing, i.e. if $from is durenmatt, - * it could replace dürenmatt in the query + * @param string $from Search term to find + * @param string $to Search term to insert + * @param boolean $normalize If we should apply text normalization when replacing * * @return void */ - public function replaceTerm( - $from, - $to, - $ignoreCase = false, - $ignoreDiacritics = false - ) { + public function replaceTerm($from, $to, $normalize = false) + { foreach ($this->getQueries() as $q) { - $q->replaceTerm( - $from, - $to, - $ignoreCase, - $ignoreDiacritics - ); + $q->replaceTerm($from, $to, $normalize); } } } From b94d2e73c69c2435907213c0277fe57f7a6f5159 Mon Sep 17 00:00:00 2001 From: Demian Katz Date: Wed, 10 Jul 2019 14:00:43 -0400 Subject: [PATCH 37/52] Remove unused method. --- .../src/VuFindSearch/Query/Query.php | 36 ------------------- 1 file changed, 36 deletions(-) diff --git a/module/VuFindSearch/src/VuFindSearch/Query/Query.php b/module/VuFindSearch/src/VuFindSearch/Query/Query.php index 832a1527d30..8d1db37bfde 100644 --- a/module/VuFindSearch/src/VuFindSearch/Query/Query.php +++ b/module/VuFindSearch/src/VuFindSearch/Query/Query.php @@ -239,42 +239,6 @@ public function replaceTerm($from, $to, $normalize = false) $this->queryString = preg_replace($pattern, $to, $queryString); } - /** - * Replaces a term with accents and umlauts removed - * - * @param string $from Search term to find - * @param string $to Search term to insert - * - * @return void - */ - public function replaceTermIgnoringAccents($from, $to) - { - // Escape $from so it is regular expression safe (just in case it - // includes any weird punctuation -- unlikely but possible): - $from = preg_quote($from, '/'); - - $from = $this->stripDiacritics($from); - - $from = strtolower($from); - - // If our "from" pattern contains non-word characters, we can't use word - // boundaries for matching. We want to try to use word boundaries when - // possible, however, to avoid the replacement from affecting unexpected - // parts of the search query. - if (!preg_match('/.*[^\w].*/', $from)) { - $pattern = "/\b$from\b/i"; - } else { - $pattern = "/$from/i"; - } - - // Perform the replacement: - $this->queryString = preg_replace( - $pattern, - $to, - strtolower($this->stripDiacritics($this->queryString)) - ); - } - /** * Remove accents and umlauts from a string * From 904d6b9a60f1020bbb8cd2ccf53d9c617403d4a6 Mon Sep 17 00:00:00 2001 From: Demian Katz Date: Wed, 10 Jul 2019 17:06:27 -0400 Subject: [PATCH 38/52] Improve readability with ternary operators. --- .../VuFind/Search/Solr/SpellingProcessor.php | 29 +++++++------------ 1 file changed, 11 insertions(+), 18 deletions(-) diff --git a/module/VuFind/src/VuFind/Search/Solr/SpellingProcessor.php b/module/VuFind/src/VuFind/Search/Solr/SpellingProcessor.php index 32a4db63568..43d15173b6b 100644 --- a/module/VuFind/src/VuFind/Search/Solr/SpellingProcessor.php +++ b/module/VuFind/src/VuFind/Search/Solr/SpellingProcessor.php @@ -291,21 +291,16 @@ protected function doSingleReplace($term, $targetTerm, $inToken, $details, ) { $returnArray[$targetTerm]['freq'] = $details['freq']; foreach ($details['suggestions'] as $word => $freq) { - // If the suggested word is part of a token - if ($inToken) { - // We need to make sure we replace the whole token - $replacement = str_replace($term, $word, $targetTerm); - } else { - $replacement = $word; - } + // If the suggested word is part of a token, we need to make sure we + // replace the whole token: + $replacement = $inToken ? str_replace($term, $word, $targetTerm) : $word; + // Do we need to show the whole, modified query? - if ($this->phrase) { - $label = $params->getDisplayQueryWithReplacedTerm( + $label = $this->phrase + ? $params->getDisplayQueryWithReplacedTerm( $targetTerm, $replacement - ); - } else { - $label = $replacement; - } + ) : $replacement; + // Basic spelling suggestion data $returnArray[$targetTerm]['suggestions'][$label] = [ 'freq' => $freq, @@ -315,11 +310,9 @@ protected function doSingleReplace($term, $targetTerm, $inToken, $details, // Only generate expansions if enabled in config if ($this->expand) { // Parentheses differ for shingles - if (strstr($targetTerm, " ") !== false) { - $replacement = "(($targetTerm) OR ($replacement))"; - } else { - $replacement = "($targetTerm OR $replacement)"; - } + $replacement = (strstr($targetTerm, " ") !== false) + ? "(($targetTerm) OR ($replacement))" + : "($targetTerm OR $replacement)"; $returnArray[$targetTerm]['suggestions'][$label]['expand_term'] = $replacement; } From 5702390af811b11c4ead85fe78c4509678bdd145 Mon Sep 17 00:00:00 2001 From: Demian Katz Date: Wed, 10 Jul 2019 17:06:27 -0400 Subject: [PATCH 39/52] Improve readability with ternary operators. From 50cd0ad2ef5a70df1cf4a6262faabd2423aef114 Mon Sep 17 00:00:00 2001 From: Lionel Walter Date: Thu, 11 Jul 2019 12:21:56 +0200 Subject: [PATCH 40/52] adapt view helper to refactored code --- module/Swissbib/src/Swissbib/View/Helper/RenderSuggestions.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module/Swissbib/src/Swissbib/View/Helper/RenderSuggestions.php b/module/Swissbib/src/Swissbib/View/Helper/RenderSuggestions.php index 264166a765c..606cebf294e 100644 --- a/module/Swissbib/src/Swissbib/View/Helper/RenderSuggestions.php +++ b/module/Swissbib/src/Swissbib/View/Helper/RenderSuggestions.php @@ -87,7 +87,7 @@ public function __invoke($results, $view) foreach ($suggested as $term => $suggestion) { $queryText = str_replace($term, $suggestion, $queryText); - $queryUrl = $queryUrl->replaceTerm($term, $suggestion, true, true); + $queryUrl = $queryUrl->replaceTerm($term, $suggestion, true); } $href=$queryUrl->getParams(); From f25acf0d203e1e91bd5a6ca50267a7a03be0c94a Mon Sep 17 00:00:00 2001 From: Silvia Witzig Date: Thu, 11 Jul 2019 12:39:02 +0200 Subject: [PATCH 41/52] Holdings.ini bb --- .../c2sbmanually/config/vufind/Holdings.ini | 6 ++- .../devbabe/config/vufind/Holdings.ini | 6 ++- .../local/config/vufind/Holdings.ini | 6 ++- .../productive/config/vufind/Holdings.ini | 39 ++----------------- .../baselbern/test/config/vufind/Holdings.ini | 6 ++- 5 files changed, 23 insertions(+), 40 deletions(-) diff --git a/local/baselbern/c2sbmanually/config/vufind/Holdings.ini b/local/baselbern/c2sbmanually/config/vufind/Holdings.ini index 550ded02d54..bc2dcfb4832 100644 --- a/local/baselbern/c2sbmanually/config/vufind/Holdings.ini +++ b/local/baselbern/c2sbmanually/config/vufind/Holdings.ini @@ -1,2 +1,6 @@ [Parent_Config] -path = local/baselbern/productive/config/vufind/Holdings.ini \ No newline at end of file +path = local/config/vufind/Holdings.ini + +; true : API activated / false or unconfigured : API not activated +[Restful] +IDSBB = true \ No newline at end of file diff --git a/local/baselbern/devbabe/config/vufind/Holdings.ini b/local/baselbern/devbabe/config/vufind/Holdings.ini index 550ded02d54..bc2dcfb4832 100644 --- a/local/baselbern/devbabe/config/vufind/Holdings.ini +++ b/local/baselbern/devbabe/config/vufind/Holdings.ini @@ -1,2 +1,6 @@ [Parent_Config] -path = local/baselbern/productive/config/vufind/Holdings.ini \ No newline at end of file +path = local/config/vufind/Holdings.ini + +; true : API activated / false or unconfigured : API not activated +[Restful] +IDSBB = true \ No newline at end of file diff --git a/local/baselbern/local/config/vufind/Holdings.ini b/local/baselbern/local/config/vufind/Holdings.ini index 550ded02d54..bc2dcfb4832 100644 --- a/local/baselbern/local/config/vufind/Holdings.ini +++ b/local/baselbern/local/config/vufind/Holdings.ini @@ -1,2 +1,6 @@ [Parent_Config] -path = local/baselbern/productive/config/vufind/Holdings.ini \ No newline at end of file +path = local/config/vufind/Holdings.ini + +; true : API activated / false or unconfigured : API not activated +[Restful] +IDSBB = true \ No newline at end of file diff --git a/local/baselbern/productive/config/vufind/Holdings.ini b/local/baselbern/productive/config/vufind/Holdings.ini index cffb05e4118..bc2dcfb4832 100644 --- a/local/baselbern/productive/config/vufind/Holdings.ini +++ b/local/baselbern/productive/config/vufind/Holdings.ini @@ -1,39 +1,6 @@ -[AlephNetworks] -IDSBB = http://aleph.unibas.ch,DSV01 -IDSSG = http://aleph.unisg.ch,HSB01 -IDSLU = http://ilu.zhbluzern.ch,ILU01 -NEBIS = http://opac.nebis.ch,EBI01 -SGBN = http://aleph.sg.ch,SGB01 -BGR = http://aleph.gr.ch,BGR01 -SBT = http://aleph.sbt.ti.ch,SBT01 -ABN = http://aleph.ag.ch,ABN01 -LIBIB = http://aleph.lbfl.li,LLB01 - -[SpecialNetworks] -RERO = https://services.test.rero.ch,RERO +[Parent_Config] +path = local/config/vufind/Holdings.ini ; true : API activated / false or unconfigured : API not activated [Restful] -IDSBB = true - -[Backlink] -ABN = "https://abn-primo.hosted.exlibrisgroup.com/primo-explore/fulldisplay?docid=41ABN_ALEPH_DS{bib-system-number}&context=L&vid=41ABN_VU1&search_scope=ABN51&tab=default_tab" -ALEPH = "{server}/F?func=item-global&doc_library={bib-library-code}&doc_number={bib-system-number}&sub_library={aleph-sublibrary-code}" -ALEX = "https://www.alexandria.ch/primo-explore/search?query=any,contains,{bib-system-number}&sortby=rank&vid=ALEX" -BISCH = "https://webopac.bibliotheken-schaffhausen.ch/TouchPoint_touchpoint/perma.do?q=0%3D%22{bib-system-number}%22+IN+%5B2%5D&v=extern&l=de" -CEO = "https://library.olympic.org/Default/doc/SYRACUSE/{bib-system-number}/" -CHARCH = "https://www.helveticarchives.ch/detail.aspx?ID={bib-system-number}" -HEMU = "http://opacbiblio.hemu-cl.ch/cgi-bin/koha/opac-detail.pl?biblionumber={bib-system-number}" -IDSBB = "http://baselbern.swissbib.ch/Record/{id}?expandlib={sub-library-code}#holding-institution-{network}-{sub-library-code}" -IDSLU = "http://iluplus.hosted.exlibrisgroup.com/41ZBL:institution_scope:41ZBL_Aleph{bib-system-number}" -IDSSG = "{server}/php/bib_holdings.php?docnr={bib-system-number}" -IDSSGFH = "{server}/F?func=item-global&doc_library={bib-library-code}&doc_number={bib-system-number}&sub_library={aleph-sublibrary-code}&local_base=fhs" -IDSSGPH = "{server}/F?func=item-global&doc_library={bib-library-code}&doc_number={bib-system-number}&sub_library={aleph-sublibrary-code}&local_base=ph" -NEBIS = "https://recherche.nebis.ch/primo-explore/fulldisplay?docid=ebi01_prod{bib-system-number}&context=L&vid=NEBIS&search_scope=default_scope&tab=default_tab" -KBTG = "http://netbiblio.tg.ch/kbtg/search/notice?noticeID={bib-system-number}" -RERO = "http://data.rero.ch/01-{bib-system-number}/html?view={RERO-network}_V1" -SGBN = "https://sgbn-primo.hosted.exlibrisgroup.com/primo-explore/fulldisplay?docid=41STGKBG_ALEPH{bib-system-number}&context=L&vid=41STGKBG_VU1&search_scope=41STGKBG-Lokal-PC&tab=default_tab&lang=de_DE" -VAUD = "https://renouvaud.hosted.exlibrisgroup.com/primo-explore/search?vid=41BCULIB_VU2&search_scope=41BCULIB_ALMA_ALL&query=any,contains,{bib-system-number}&sortby=rank" -VAUDS = "https://renouvaud.hosted.exlibrisgroup.com/primo-explore/search?vid=41BCULIB_VU2&search_scope=41BCULIB_ALMA_ALL&query=any,contains,{bib-system-number}&sortby=rank" -CCSA = "https://nb-posters.primo.exlibrisgroup.com/discovery/fulldisplay?docid=alma{bib-system-number}&context=L&vid=41SNL_53_INST:posters&search_scope=MyInstitution&tab=LibraryCatalog" -SNL = "https://nb-helveticat.primo.exlibrisgroup.com/discovery/fulldisplay?docid=alma{bib-system-number}&context=L&vid=41SNL_51_INST:helveticat&search_scope=MyInstitution&tab=LibraryCatalog" \ No newline at end of file +IDSBB = true \ No newline at end of file diff --git a/local/baselbern/test/config/vufind/Holdings.ini b/local/baselbern/test/config/vufind/Holdings.ini index 550ded02d54..bc2dcfb4832 100644 --- a/local/baselbern/test/config/vufind/Holdings.ini +++ b/local/baselbern/test/config/vufind/Holdings.ini @@ -1,2 +1,6 @@ [Parent_Config] -path = local/baselbern/productive/config/vufind/Holdings.ini \ No newline at end of file +path = local/config/vufind/Holdings.ini + +; true : API activated / false or unconfigured : API not activated +[Restful] +IDSBB = true \ No newline at end of file From c2763405fd8b4574b6400266395f954889d8448c Mon Sep 17 00:00:00 2001 From: Lionel Walter Date: Thu, 11 Jul 2019 13:10:10 +0200 Subject: [PATCH 42/52] use case-sensitive strpos instead of case-insensitive stripos --- module/VuFind/src/VuFind/Search/Solr/SpellingProcessor.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module/VuFind/src/VuFind/Search/Solr/SpellingProcessor.php b/module/VuFind/src/VuFind/Search/Solr/SpellingProcessor.php index 43d15173b6b..ace9bde3e20 100644 --- a/module/VuFind/src/VuFind/Search/Solr/SpellingProcessor.php +++ b/module/VuFind/src/VuFind/Search/Solr/SpellingProcessor.php @@ -252,7 +252,7 @@ public function processSuggestions($suggestions, $query, Params $params) foreach ($this->tokenize($query) as $token) { // TODO - Do we need stricter matching here, similar to that in // \VuFindSearch\Query\Query::replaceTerm()? - if (stripos($token, $term) !== false) { + if (strpos($token, $term) !== false) { $inToken = true; // We need to replace the whole token $targetTerm = $token; From f4a70e6bf2bd7c9eae3c0fa348f2e1768ddf980f Mon Sep 17 00:00:00 2001 From: Lionel Walter Date: Thu, 11 Jul 2019 13:12:32 +0200 Subject: [PATCH 43/52] remove useless use --- module/Swissbib/src/Swissbib/View/Helper/RenderSuggestions.php | 1 - 1 file changed, 1 deletion(-) diff --git a/module/Swissbib/src/Swissbib/View/Helper/RenderSuggestions.php b/module/Swissbib/src/Swissbib/View/Helper/RenderSuggestions.php index 606cebf294e..4c81a2e2275 100644 --- a/module/Swissbib/src/Swissbib/View/Helper/RenderSuggestions.php +++ b/module/Swissbib/src/Swissbib/View/Helper/RenderSuggestions.php @@ -28,7 +28,6 @@ */ namespace Swissbib\View\Helper; -use Swissbib\VuFind\Db\Row\NationalLicenceUser; use VuFind\Search\UrlQueryHelper; use VuFindSearch\Query\Query; use Zend\View\Helper\AbstractHelper; From 44275b65b82055cdeec830371a4da0847cc86ac6 Mon Sep 17 00:00:00 2001 From: Lionel Walter Date: Thu, 11 Jul 2019 13:30:26 +0200 Subject: [PATCH 44/52] codestyle --- .../Swissbib/Controller/SearchController.php | 48 +++++++++++++------ .../src/Swissbib/RecordDriver/SolrMarc.php | 9 ++-- 2 files changed, 40 insertions(+), 17 deletions(-) diff --git a/module/Swissbib/src/Swissbib/Controller/SearchController.php b/module/Swissbib/src/Swissbib/Controller/SearchController.php index 58b64cf72ef..4f3596a2603 100644 --- a/module/Swissbib/src/Swissbib/Controller/SearchController.php +++ b/module/Swissbib/src/Swissbib/Controller/SearchController.php @@ -128,7 +128,7 @@ public function availabilityByLibraryNetworkAction() $record = $this->getRecord($idRecord); $availabilities = []; - if (empty($record->getField('949',['B','F','b','c','j']))) { + if (empty($record->getField('949', ['B','F','b','c','j']))) { $field898a = $record->getField('898', ['a']); $field898a = $field898a[0]; if (substr_compare($field898a, '53', -strlen('53')) == 0) { @@ -141,17 +141,37 @@ public function availabilityByLibraryNetworkAction() ); } } else { - $doAlephRequest = - substr_compare($field898a, 'CR02', 0, strlen('CR02')) === 0 || - substr_compare($field898a, 'CR0300', 0, strlen('CR0300')) === 0 || - substr_compare($field898a, 'CR0301', 0, strlen('CR0301')) === 0 || - substr_compare($field898a, 'CR0302', 0, strlen('CR0302')) === 0 || - substr_compare($field898a, 'CR0303', 0, strlen('CR0303')) === 0 || - substr_compare($field898a, 'CR0304', 0, strlen('CR0304')) === 0 || - substr_compare($field898a, 'CR0305', 0, strlen('CR0305')) === 0 || - substr_compare($field898a, 'CR0306', 0, strlen('CR0306')) === 0 || - substr_compare($field898a, 'CR0307', 0, strlen('CR0307')) === 0 || - substr_compare($field898a, 'CR0308', 0, strlen('CR0308')) === 0; + $doAlephRequest + = substr_compare( + $field898a, 'CR02', 0, strlen('CR02') + ) === 0 || + substr_compare( + $field898a, 'CR0300', 0, strlen('CR0300') + ) === 0 || + substr_compare( + $field898a, 'CR0301', 0, strlen('CR0301') + ) === 0 || + substr_compare( + $field898a, 'CR0302', 0, strlen('CR0302') + ) === 0 || + substr_compare( + $field898a, 'CR0303', 0, strlen('CR0303') + ) === 0 || + substr_compare( + $field898a, 'CR0304', 0, strlen('CR0304') + ) === 0 || + substr_compare( + $field898a, 'CR0305', 0, strlen('CR0305') + ) === 0 || + substr_compare( + $field898a, 'CR0306', 0, strlen('CR0306') + ) === 0 || + substr_compare( + $field898a, 'CR0307', 0, strlen('CR0307') + ) === 0 || + substr_compare( + $field898a, 'CR0308', 0, strlen('CR0308') + ) === 0; if ($doAlephRequest) { $availabilities = $this->doAlephAvailabilityRequest($record); } @@ -169,11 +189,11 @@ public function availabilityByLibraryNetworkAction() /** * Do Aleph Availability Request * - * @param $record SolrMarc the solrMarc record + * @param SolrMarc $record the solrMarc record * * @return array */ - private function doAlephAvailabilityRequest(SolrMarc $record) + protected function doAlephAvailabilityRequest(SolrMarc $record) { $availabilities = []; $alwaysAvailableGroups = [ diff --git a/module/Swissbib/src/Swissbib/RecordDriver/SolrMarc.php b/module/Swissbib/src/Swissbib/RecordDriver/SolrMarc.php index 7bfa2822774..d871393b89d 100644 --- a/module/Swissbib/src/Swissbib/RecordDriver/SolrMarc.php +++ b/module/Swissbib/src/Swissbib/RecordDriver/SolrMarc.php @@ -2825,9 +2825,12 @@ public function getHoldingsStructure() * * @return array */ - public function getField($field, $subfields = null, $concat = true, - $separator = ' ') - { + public function getField( + $field, + $subfields = null, + $concat = true, + $separator = ' ' + ) { return $this->getFieldArray($field, $subfields, $concat, $separator); } From 278b0cb288a6e7ec2f523364ff03c19be090e31e Mon Sep 17 00:00:00 2001 From: Lionel Walter Date: Thu, 11 Jul 2019 13:32:21 +0200 Subject: [PATCH 45/52] remove wrongly analyzed localcode from simple search --- local/config/vufind/searchspecs.yaml | 1 - local/config/vufind/searchspecs_jusbib.yaml | 3 +-- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/local/config/vufind/searchspecs.yaml b/local/config/vufind/searchspecs.yaml index 9a716fc9c8e..ff78b41ae41 100644 --- a/local/config/vufind/searchspecs.yaml +++ b/local/config/vufind/searchspecs.yaml @@ -38,7 +38,6 @@ AllFields: - ismn_isn_mv - doi_isn_mv - urn_isn_mv - - localcode # local codes (field 909) : should be removed after next full reindex. It will be replaced by localcode_txt_mv - localcode_txt_mv # local codes splitted at spaces - id_txt DismaxParams: diff --git a/local/config/vufind/searchspecs_jusbib.yaml b/local/config/vufind/searchspecs_jusbib.yaml index df48e9e8fa2..c9f565f6973 100644 --- a/local/config/vufind/searchspecs_jusbib.yaml +++ b/local/config/vufind/searchspecs_jusbib.yaml @@ -33,11 +33,10 @@ AllFields: - variant_isbn_isn_mv - issn - incoissn_isn_mv - - localcode # local codes (field 909) : should be removed after next full reindex. It will be replaced by localcode_txt_mv - localcode_txt_mv # local codes splitted at spaces - id_txt DismaxParams: - - [pf, 'title_short^1000 callnumber_txt_mv^100'] + - [pf, 'title_short^1000 callnumber_txt_mv^100 localcode_txt_mv^10'] - [ps, '2'] - [bf, 'recip(abs(ms(NOW/DAY,freshness)),3.16e-10,100,100)'] From 0c9d44cb88e76b65c7f343cf09b9a75ff8870d95 Mon Sep 17 00:00:00 2001 From: Lionel Walter Date: Thu, 11 Jul 2019 13:52:59 +0200 Subject: [PATCH 46/52] codestyle --- .../Swissbib/src/Swissbib/View/Helper/RenderSuggestions.php | 1 - .../VuFind/Search/Solr/InjectSwissbibSpellingListener.php | 5 +++-- module/Swissbib/src/Swissbib/VuFind/Search/Solr/Results.php | 3 --- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/module/Swissbib/src/Swissbib/View/Helper/RenderSuggestions.php b/module/Swissbib/src/Swissbib/View/Helper/RenderSuggestions.php index 4c81a2e2275..cade01b2964 100644 --- a/module/Swissbib/src/Swissbib/View/Helper/RenderSuggestions.php +++ b/module/Swissbib/src/Swissbib/View/Helper/RenderSuggestions.php @@ -94,7 +94,6 @@ public function __invoke($results, $view) $html .= '' . $view->escapeHtml($queryText) . ''; - return $html; } } diff --git a/module/Swissbib/src/Swissbib/VuFind/Search/Solr/InjectSwissbibSpellingListener.php b/module/Swissbib/src/Swissbib/VuFind/Search/Solr/InjectSwissbibSpellingListener.php index 139d8be70d4..b09c2c1a9a1 100644 --- a/module/Swissbib/src/Swissbib/VuFind/Search/Solr/InjectSwissbibSpellingListener.php +++ b/module/Swissbib/src/Swissbib/VuFind/Search/Solr/InjectSwissbibSpellingListener.php @@ -29,11 +29,12 @@ * @link http://www.swissbib.org */ namespace Swissbib\VuFind\Search\Solr; + use VuFind\Search\Solr\InjectSpellingListener as VFSpellingListener; use VuFindSearch\Backend\Solr\Response\Json\Spellcheck; -use VuFindSearch\ParamBag; use VuFindSearch\Query\Query; use Zend\EventManager\EventInterface; + /** * InjectSwissbibSpellingListener * @@ -84,4 +85,4 @@ public function onSearchPre(EventInterface $event) } return $event; } -} \ No newline at end of file +} diff --git a/module/Swissbib/src/Swissbib/VuFind/Search/Solr/Results.php b/module/Swissbib/src/Swissbib/VuFind/Search/Solr/Results.php index 1dfea827d47..a60cbc3d348 100644 --- a/module/Swissbib/src/Swissbib/VuFind/Search/Solr/Results.php +++ b/module/Swissbib/src/Swissbib/VuFind/Search/Solr/Results.php @@ -240,12 +240,9 @@ protected function performSearch() $this->spellingQuery = $spellcheck->getQuery(); $this->suggestions = $this->getSpellingProcessor() ->getSuggestions($spellcheck, $this->getParams()->getQuery()); - - } // Construct record drivers for all the items in the response: $this->results = $collection->getRecords(); } - } From e6433942fc05aa98ac5de2fac163324133c0b41a Mon Sep 17 00:00:00 2001 From: edelm Date: Thu, 11 Jul 2019 13:59:48 +0200 Subject: [PATCH 47/52] fix typo in code --- module/Swissbib/src/Swissbib/RecordDriver/Helper/Holdings.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module/Swissbib/src/Swissbib/RecordDriver/Helper/Holdings.php b/module/Swissbib/src/Swissbib/RecordDriver/Helper/Holdings.php index 3bd6cfc0b06..a62e86041e4 100644 --- a/module/Swissbib/src/Swissbib/RecordDriver/Helper/Holdings.php +++ b/module/Swissbib/src/Swissbib/RecordDriver/Helper/Holdings.php @@ -507,7 +507,7 @@ protected function initNetworks() */ $networkConfigs = $this->configHoldings->get($configName); - if (!empty($networkConfig)) { + if (!empty($networkConfigs)) { foreach ($networkConfigs as $networkCode => $networkConfig) { list($domain, $library) = explode(',', $networkConfig, 2); $this->networks[$networkCode] = [ From 6b54ba618e8bf324c99098a0ccb2d521eb25f796 Mon Sep 17 00:00:00 2001 From: edelmatthias Date: Thu, 11 Jul 2019 17:09:49 +0200 Subject: [PATCH 48/52] remove unneccessary display elements for cluster entries on resultlist --- .../RecordDriver/DefaultRecord/result-list.phtml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/themes/sbvfrd/templates/RecordDriver/DefaultRecord/result-list.phtml b/themes/sbvfrd/templates/RecordDriver/DefaultRecord/result-list.phtml index ebf5ac542c8..479fc26375e 100644 --- a/themes/sbvfrd/templates/RecordDriver/DefaultRecord/result-list.phtml +++ b/themes/sbvfrd/templates/RecordDriver/DefaultRecord/result-list.phtml @@ -19,6 +19,7 @@ $uniqueID = $record->getUniqueID(); $showFRBR = $this->configAccess()->Site->displayFrbr; $memorizeLink = $this->recordLink()->getActionUrl($this->driver, 'Save'); $formats = $viewRecord->getFormatList(); +$isFRBR = (!empty($showFRBR) && $showFRBR && !empty($groupID) &&!strcmp($results->getParams()->getSearchHandler(), 'FRBR') == 0); ?>
@@ -81,13 +82,13 @@ $formats = $viewRecord->getFormatList();
- +
escapeHtml($summDate[0]) ?>
- +
escapeHtml($edition) ?>
@@ -103,7 +104,7 @@ $formats = $viewRecord->getFormatList();
- +
@@ -121,7 +122,7 @@ $formats = $viewRecord->getFormatList(); render('search/results/links.phtml') ?> - getParams()->getSearchHandler(), 'FRBR') == 0) : ?> + $availinfo) { $statusfield = $availinfo["statusfield"]; if (isset($availinfo["borrowingInformation"])) { - $borrowinginformation = $availinfo["borrowingInformation"]; + $borrowingInfo = $availinfo["borrowingInformation"]; } } @@ -144,22 +144,24 @@ public function __invoke($availability, $institution = "") break; case self::LENDABLE_BORROWED: - unset($borrowinginformation['due_hour']); + unset($borrowingInfo['due_hour']); $info = "
"; - if ($borrowinginformation['due_date'] === 'on reserve') { - $info .= $escapedTranslation('On Reserve') . " (" . - $borrowinginformation['no_requests'] . ")"; - } elseif ($borrowinginformation['due_date'] === 'claimed returned') { - $info .= $escapedTranslation('Claimed Returned'); - } elseif ($borrowinginformation['due_date'] === 'lost') { - $info .= $escapedTranslation('Lost'); - } elseif ($borrowinginformation['due_date'] === 'on hold') { - $info .= $escapedTranslation('on_hold') . "
" . - $escapedTranslation('no_requests') . " " . - $borrowinginformation['no_requests'] . "
"; + if (isset($borrowingInfo['due_date'])) { + if ($borrowingInfo['due_date'] === 'on reserve') { + $info .= $escapedTranslation('On Reserve') . " (" . + $borrowingInfo['no_requests'] . ")"; + } elseif ($borrowingInfo['due_date'] === 'claimed returned') { + $info .= $escapedTranslation('Claimed Returned'); + } elseif ($borrowingInfo['due_date'] === 'lost') { + $info .= $escapedTranslation('Lost'); + } elseif ($borrowingInfo['due_date'] === 'on hold') { + $info .= $escapedTranslation('on_hold') . "
" . + $escapedTranslation('no_requests') . " " . + $borrowingInfo['no_requests'] . "
"; + } } else { - foreach ($borrowinginformation as $key => $value) { + foreach ($borrowingInfo as $key => $value) { if (strcmp(trim($value), "") != 0) { $info .= "
" . $escapedTranslation($key) . " " . $value . "
"; @@ -172,30 +174,30 @@ public function __invoke($availability, $institution = "") break; case self::LENDABLESHORT: - if (!empty($borrowinginformation['due_date'])) { - unset($borrowinginformation['due_hour']); + if (!empty($borrowingInfo['due_date'])) { + unset($borrowingInfo['due_hour']); $infotext = $escapedTranslation($statusfield); $info = "
" . "$infotext" . "
"; - if ($borrowinginformation['due_date'] === 'on reserve') { + if ($borrowingInfo['due_date'] === 'on reserve') { $info .= $escapedTranslation('On Reserve') . " (" . - $borrowinginformation['no_requests'] . ")"; + $borrowingInfo['no_requests'] . ")"; // @codingStandardsIgnoreStart - } elseif ($borrowinginformation['due_date'] === + } elseif ($borrowingInfo['due_date'] === 'claimed returned') { // @codingStandardsIgnoreEnd $info .= $escapedTranslation('Claimed Returned'); - } elseif ($borrowinginformation['due_date'] === 'lost') { + } elseif ($borrowingInfo['due_date'] === 'lost') { $info .= $escapedTranslation('Lost'); - } elseif ($borrowinginformation['due_date'] === 'on hold') { + } elseif ($borrowingInfo['due_date'] === 'on hold') { $info .= $escapedTranslation('on_hold') . "
" . $escapedTranslation('no_requests') . " " . - $borrowinginformation['no_requests'] . "
"; + $borrowingInfo['no_requests'] . "
"; } else { - foreach ($borrowinginformation as $key => $value) { + foreach ($borrowingInfo as $key => $value) { if (strcmp(trim($value), "") != 0) { $info .= "
" . $escapedTranslation($key) . " " . $value . "
"; @@ -203,7 +205,7 @@ public function __invoke($availability, $institution = "") } } $info .= "
"; - } elseif (empty($borrowinginformation['due_date'])) { + } elseif (empty($borrowingInfo['due_date'])) { $infotext = $escapedTranslation($statusfield); $info = "
" . "$infotext" . "
"; @@ -213,30 +215,30 @@ public function __invoke($availability, $institution = "") case self::USE_ON_SITE: - if (!empty($borrowinginformation['due_date'])) { - unset($borrowinginformation['due_hour']); + if (!empty($borrowingInfo['due_date'])) { + unset($borrowingInfo['due_hour']); $infotext = $escapedTranslation($statusfield); $info = "
" . "$infotext" . "
"; - if ($borrowinginformation['due_date'] === 'on reserve') { + if ($borrowingInfo['due_date'] === 'on reserve') { $info .= $escapedTranslation('On Reserve') . " (" . - $borrowinginformation['no_requests'] . ")"; + $borrowingInfo['no_requests'] . ")"; // @codingStandardsIgnoreStart - } elseif ($borrowinginformation['due_date'] === + } elseif ($borrowingInfo['due_date'] === 'claimed returned') { // @codingStandardsIgnoreEnd $info .= $escapedTranslation('Claimed Returned'); - } elseif ($borrowinginformation['due_date'] === 'lost') { + } elseif ($borrowingInfo['due_date'] === 'lost') { $info .= $escapedTranslation('Lost'); - } elseif ($borrowinginformation['due_date'] === 'on hold') { + } elseif ($borrowingInfo['due_date'] === 'on hold') { $info .= $escapedTranslation('on_hold') . "
" . $escapedTranslation('no_requests') . " " . - $borrowinginformation['no_requests'] . "
"; + $borrowingInfo['no_requests'] . "
"; } else { - foreach ($borrowinginformation as $key => $value) { + foreach ($borrowingInfo as $key => $value) { if (strcmp(trim($value), "") != 0) { $info .= "
" . $escapedTranslation($key) . " " . $value . "
"; @@ -244,7 +246,7 @@ public function __invoke($availability, $institution = "") } } $info .= "
"; - } elseif (empty($borrowinginformation['due_date'])) { + } elseif (empty($borrowingInfo['due_date'])) { $infotext = $escapedTranslation($statusfield); $info = "
" . "$infotext" . "
"; @@ -253,30 +255,30 @@ public function __invoke($availability, $institution = "") break; case self::LIBRARYINFO: - if (!empty($borrowinginformation['due_date'])) { - unset($borrowinginformation['due_hour']); + if (!empty($borrowingInfo['due_date'])) { + unset($borrowingInfo['due_hour']); $infotext = $escapedTranslation($statusfield); $info = "
" . "$infotext" . "
"; - if ($borrowinginformation['due_date'] === 'on reserve') { + if ($borrowingInfo['due_date'] === 'on reserve') { $info .= $escapedTranslation('On Reserve') . " (" . - $borrowinginformation['no_requests'] . ")"; + $borrowingInfo['no_requests'] . ")"; // @codingStandardsIgnoreStart - } elseif ($borrowinginformation['due_date'] === + } elseif ($borrowingInfo['due_date'] === 'claimed returned') { // @codingStandardsIgnoreEnd $info .= $escapedTranslation('Claimed Returned'); - } elseif ($borrowinginformation['due_date'] === 'lost') { + } elseif ($borrowingInfo['due_date'] === 'lost') { $info .= $escapedTranslation('Lost'); - } elseif ($borrowinginformation['due_date'] === 'on hold') { + } elseif ($borrowingInfo['due_date'] === 'on hold') { $info .= $escapedTranslation('on_hold') . "
" . $escapedTranslation('no_requests') . " " . - $borrowinginformation['no_requests'] . "
"; + $borrowingInfo['no_requests'] . "
"; } else { - foreach ($borrowinginformation as $key => $value) { + foreach ($borrowingInfo as $key => $value) { if (strcmp(trim($value), "") != 0) { $info .= "
" . $escapedTranslation($key) . " " . $value . "
"; @@ -284,7 +286,7 @@ public function __invoke($availability, $institution = "") } } $info .= "
"; - } elseif (empty($borrowinginformation['due_date'])) { + } elseif (empty($borrowingInfo['due_date'])) { $infotext = $escapedTranslation($statusfield); $info = "
" . "$infotext" . "
"; } @@ -305,15 +307,15 @@ public function __invoke($availability, $institution = "") break; case self::EXHIBITION: - unset($borrowinginformation['due_hour']); + unset($borrowingInfo['due_hour']); $infotext = $escapedTranslation($statusfield); $info = "
Ausstellung"; - if ($borrowinginformation['due_date'] === 'on reserve') { + if ($borrowingInfo['due_date'] === 'on reserve') { $info .= $escapedTranslation('On Reserve') . " (" . - $borrowinginformation['no_requests'] . ")"; + $borrowingInfo['no_requests'] . ")"; } else { - foreach ($borrowinginformation as $key => $value) { + foreach ($borrowingInfo as $key => $value) { if (strcmp(trim($value), "") != 0) { $info .= "
" . $escapedTranslation($key) . " " . $value . "
"; @@ -325,17 +327,17 @@ public function __invoke($availability, $institution = "") break; case self::INPROCESS: - if (!empty($borrowinginformation['due_date'])) { - unset($borrowinginformation['due_hour']); + if (!empty($borrowingInfo['due_date'])) { + unset($borrowingInfo['due_hour']); $infotext = $escapedTranslation($statusfield); $info = "
" . "$infotext" . "
"; - if ($borrowinginformation['due_date'] === 'on reserve') { + if ($borrowingInfo['due_date'] === 'on reserve') { $info .= $escapedTranslation('On Reserve') . " (" . - $borrowinginformation['no_requests'] . ")"; + $borrowingInfo['no_requests'] . ")"; } else { - foreach ($borrowinginformation as $key => $value) { + foreach ($borrowingInfo as $key => $value) { if (strcmp(trim($value), "") != 0) { $info .= "
" . $escapedTranslation($key) . " " . $value . "
"; @@ -343,7 +345,7 @@ public function __invoke($availability, $institution = "") } } $info .= "
"; - } elseif (empty($borrowinginformation['due_date'])) { + } elseif (empty($borrowingInfo['due_date'])) { $infotext = $escapedTranslation($statusfield); $info = "
" . "$infotext" . "
"; From 634cbf129bba443a401e24afc6eb6c66c2a30f0b Mon Sep 17 00:00:00 2001 From: edelm Date: Fri, 12 Jul 2019 10:10:43 +0200 Subject: [PATCH 50/52] prevent php notice (Only variables should be passed by reference) in error.log --- module/Swissbib/src/Swissbib/Hierarchy/SimpleTreeGenerator.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/module/Swissbib/src/Swissbib/Hierarchy/SimpleTreeGenerator.php b/module/Swissbib/src/Swissbib/Hierarchy/SimpleTreeGenerator.php index 7b1d419a68c..89d2fded989 100644 --- a/module/Swissbib/src/Swissbib/Hierarchy/SimpleTreeGenerator.php +++ b/module/Swissbib/src/Swissbib/Hierarchy/SimpleTreeGenerator.php @@ -156,7 +156,8 @@ public function getTree(array $facets = [], $treeKey = '') return $this->generatePageTree($this->orderAndFilter($facets)); } - $tree = $this->generatePageTree($this->orderAndFilter($facets)); + $datas = $this->orderAndFilter($facets); + $tree = $this->generatePageTree($datas); $this->objectCache->setItem($cacheTreeId, $tree); return $tree; From e1d1695292e27cab1dd6e8d5582858204528b9d0 Mon Sep 17 00:00:00 2001 From: edelm Date: Fri, 12 Jul 2019 10:39:52 +0200 Subject: [PATCH 51/52] prevent php notice/warning in error.log --- .../Swissbib/src/Swissbib/RecordDriver/Helper/Holdings.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/module/Swissbib/src/Swissbib/RecordDriver/Helper/Holdings.php b/module/Swissbib/src/Swissbib/RecordDriver/Helper/Holdings.php index a62e86041e4..7b48c327daa 100644 --- a/module/Swissbib/src/Swissbib/RecordDriver/Helper/Holdings.php +++ b/module/Swissbib/src/Swissbib/RecordDriver/Helper/Holdings.php @@ -640,8 +640,10 @@ public function getAllBarcodes(SolrMarc $recordDriver, String $institution) { $r = []; $holdings = $this->getHoldings($recordDriver, $institution); - foreach ($holdings['items'] as $item) { - array_push($r, $item['barcode']); + if (isset($holdings['items'])) { + foreach ($holdings['items'] as $item) { + array_push($r, $item['barcode']); + } } return $r; } From 14680da0bab13870c185f09d87f9f4ec27323c9e Mon Sep 17 00:00:00 2001 From: edelm Date: Fri, 12 Jul 2019 11:22:27 +0200 Subject: [PATCH 52/52] prevent php notice/warning in error.log --- .../src/Swissbib/RecordDriver/SolrMarc.php | 32 ++++++++++--------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/module/Swissbib/src/Swissbib/RecordDriver/SolrMarc.php b/module/Swissbib/src/Swissbib/RecordDriver/SolrMarc.php index d871393b89d..d4ae0e7cd97 100644 --- a/module/Swissbib/src/Swissbib/RecordDriver/SolrMarc.php +++ b/module/Swissbib/src/Swissbib/RecordDriver/SolrMarc.php @@ -2882,24 +2882,26 @@ public function getAll035Idls() */ public function getAvailabilityIconFromServer($idls, $sysNr) { - $r = []; + $r = $r3 = []; $userLocale = $this->translator->getLocale(); if ($idls == 'RERO') { $hh = $this->getHoldingsHelper(); - $institutions = $hh->getHoldingsStructure()[$idls]['institutions']; - foreach ($institutions as $institution) { - $institutionCode = $institution['label']; - $hh->resetHolding(); - $barcodes = $hh->getAllBarcodes($this, $institutionCode); - $r2 = $this->availabilityHelper - ->getAvailability($sysNr, $barcodes, $idls, $userLocale); - $r3 = []; - foreach ($r2 as $key => $val) { - if ($val['statusfield'] == 'lendable_available') { - $r3[$institutionCode] = '0'; - break; - } elseif ($val['statusfield'] == 'lendable_borrowed') { - $r3[$institutionCode] = '1'; + $hs = $hh->getHoldingsStructure(); + if (isset($hs[$idls])) { + $institutions = $hh->getHoldingsStructure()[$idls]['institutions']; + foreach ($institutions as $institution) { + $institutionCode = $institution['label']; + $hh->resetHolding(); + $barcodes = $hh->getAllBarcodes($this, $institutionCode); + $r2 = $this->availabilityHelper + ->getAvailability($sysNr, $barcodes, $idls, $userLocale); + foreach ($r2 as $key => $val) { + if ($val['statusfield'] == 'lendable_available') { + $r3[$institutionCode] = '0'; + break; + } elseif ($val['statusfield'] == 'lendable_borrowed') { + $r3[$institutionCode] = '1'; + } } } $r = array_merge($r, $r3);