diff --git a/config/vufind/Search2.ini b/config/vufind/Search2.ini new file mode 100644 index 0000000000000000000000000000000000000000..18cf857b57e6696d09928dde5be5ef5b8a29822b --- /dev/null +++ b/config/vufind/Search2.ini @@ -0,0 +1,195 @@ +; This configuration file can be used to set up a secondary Solr index that behaves +; similarly to VuFind's default search. This instance is accessible under /Search2 +; URLs within VuFind. +; +; This can be used in combination with Combined Search (see Combined.ini) to create +; a tabbed interface searching multiple indexes. It can also be useful for pulling +; in results from an external/third-party index. +; +; Most of the settings found in searches.ini and facets.ini can be dropped into +; this file and will behave the same way. Some selected settings from config.ini +; that apply only to the main Solr index are also overridden here. To ease +; maintenance of documentation, comments from those files are not duplicated here. +; See those files for more details of how all settings work. Look for section +; marker comments within this file to see where groups of settings come from. + +; ---------- config.ini settings ---------- + +[Index] +url = http://localhost:8080/solr +default_core = biblio +maxBooleanClauses = 1024 +timeout = 30 +default_dismax_handler = dismax + +[Spelling] +enabled = true +limit = 3 +phrase = false +expand = true +simple = false +skip_numeric = true + +[Record] +next_prev_navigation = false + +; ---------- searches.ini settings ---------- + +[General] +default_handler = AllFields +default_sort = relevance +default_view = list +default_limit = 20 +case_sensitive_bools = true +case_sensitive_ranges = true + +default_top_recommend[] = TopFacets:ResultsTop:Search2 +default_top_recommend[] = SpellingSuggestions +default_side_recommend[] = SideFacets:Results:CheckboxFacets:Search2 +default_noresults_recommend[] = SwitchType +default_noresults_recommend[] = SwitchQuery:::fuzzy +default_noresults_recommend[] = SpellingSuggestions +default_noresults_recommend[] = RemoveFilters + +highlighting = true +snippets = true +retain_filters_by_default = true + +[Cache] +type = File + +[Basic_Searches] +AllFields = "All Fields" +Title = Title +Author = Author +Subject = Subject +CallNumber = "Call Number" +ISN = "ISBN/ISSN" +tag = Tag + +[Advanced_Searches] +AllFields = adv_search_all +Title = adv_search_title +Author = adv_search_author +Subject = adv_search_subject +CallNumber = adv_search_callnumber +ISN = adv_search_isn +publisher = adv_search_publisher +Series = adv_search_series +year = adv_search_year +toc = adv_search_toc + +[Sorting] +relevance = sort_relevance +year = sort_year +year asc = "sort_year asc" +callnumber-sort = sort_callnumber +author = sort_author +title = sort_title + +[DefaultSortingByType] +CallNumber = callnumber-sort + +[SideRecommendations] + +[TopRecommendations] +Author[] = AuthorFacets +Author[] = SpellingSuggestions +CallNumber[] = "TopFacets:ResultsTop" + +[NoResultsRecommendations] +CallNumber[] = SwitchQuery::wildcard:truncatechar +CallNumber[] = RemoveFilters + +[Autocomplete] +enabled = true +default_handler = Search2 + +[Autocomplete_Types] +Title = "Search2:Title" +JournalTitle = "Search2:JournalTitle" +Author = "Search2:Author:author,author2" +Subject = "Search2:Subject:topic,genre,geographic,era" +CallNumber = "Search2CN" +ISN = "Search2:ISN:isbn,issn" +Coordinate = "None" +tag = "Tag" + +[Snippet_Captions] +author2 = "Other Authors" +contents = "Table of Contents" +topic = "Subjects" +container_title = "Journal Title" + +[List] +view=full + +[HiddenFilters] + +[RawHiddenFilters] + +[ConditionalHiddenFilters] + +[Records] + +[MoreLikeThis] + +[HomePage] +content[] = FacetList:Search2 + +; ---------- facets.ini settings ---------- + +[Results] +institution = Institution +building = Library +format = Format +callnumber-first = "Call Number" +author_facet = Author +language = Language +genre_facet = Genre +era_facet = Era +geographic_facet = Region +publishDate = "adv_search_year" + +[ResultsTop] +topic_facet = "Suggested Topics" + +[ExtraFacetLabels] +long_lat = "Geographic Search" + +[SpecialFacets] +dateRange[] = publishDate + +[CheckboxFacets] + +[Results_Settings] +facet_limit = 30 +showMore[*] = 6 +showMoreInLightbox[*] = more +top_rows = 2 +top_cols = 3 + +[Advanced_Facets] +callnumber-first = "Call Number" +language = Language +format = Format + +[Advanced_Settings] +facet_limit = 100 +orFacets = * +delimiter = "{{{_:::_}}}" +special_facets = "illustrated,daterange" +translated_facets[] = format +translated_facets[] = callnumber-first:CallNumberFirst + +[HomePage_Facets] +callnumber-first = "Call Number" +language = Language +format = Format + +[HomePage_Facet_Settings] +facet_limit = 20 + +[LegacyFields] + +[HideFacetValue] diff --git a/module/VuFind/config/module.config.php b/module/VuFind/config/module.config.php index 8219ee2c30d461f8fa1e6b3cd02950e3ff8eb7cf..73c6cefe64dc7d01e255c31276a92b7afdf4bf19 100644 --- a/module/VuFind/config/module.config.php +++ b/module/VuFind/config/module.config.php @@ -126,6 +126,8 @@ $config = [ 'VuFind\Controller\ErrorController' => 'VuFind\Controller\AbstractBaseFactory', 'VuFind\Controller\ExternalAuthController' => 'VuFind\Controller\AbstractBaseFactory', 'VuFind\Controller\FeedbackController' => 'VuFind\Controller\AbstractBaseFactory', + 'VuFind\Controller\Search2Controller' => 'VuFind\Controller\AbstractBaseFactory', + 'VuFind\Controller\Search2recordController' => 'VuFind\Controller\AbstractBaseFactory', 'VuFind\Controller\HelpController' => 'VuFind\Controller\AbstractBaseFactory', 'VuFind\Controller\HierarchyController' => 'VuFind\Controller\AbstractBaseFactory', 'VuFind\Controller\IndexController' => 'VuFind\Controller\IndexControllerFactory', @@ -195,6 +197,10 @@ $config = [ 'externalauth' => 'VuFind\Controller\ExternalAuthController', 'Feedback' => 'VuFind\Controller\FeedbackController', 'feedback' => 'VuFind\Controller\FeedbackController', + 'Search2' => 'VuFind\Controller\Search2Controller', + 'search2' => 'VuFind\Controller\Search2Controller', + 'Search2Record' => 'VuFind\Controller\Search2recordController', + 'search2record' => 'VuFind\Controller\Search2recordController', 'Help' => 'VuFind\Controller\HelpController', 'help' => 'VuFind\Controller\HelpController', 'Hierarchy' => 'VuFind\Controller\HierarchyController', @@ -635,6 +641,7 @@ $recordRoutes = [ 'solrauthrecord' => 'Authority', 'summonrecord' => 'SummonRecord', 'worldcatrecord' => 'WorldcatRecord', + 'search2record' => 'Search2Record', // For legacy (1.x/2.x) compatibility: 'vufindrecord' => 'Record', @@ -686,6 +693,7 @@ $staticRoutes = [ 'Search/FacetList', 'Search/History', 'Search/Home', 'Search/NewItem', 'Search/OpenSearch', 'Search/Reserves', 'Search/ReservesFacetList', 'Search/Results', 'Search/Suggest', + 'Search2/Advanced', 'Search2/Home', 'Search2/Results', 'Summon/Advanced', 'Summon/FacetList', 'Summon/Home', 'Summon/Search', 'Tag/Home', 'Upgrade/Home', 'Upgrade/FixAnonymousTags', 'Upgrade/FixDuplicateTags', diff --git a/module/VuFind/src/VuFind/Autocomplete/PluginManager.php b/module/VuFind/src/VuFind/Autocomplete/PluginManager.php index 27b740d9d6ff857e1180de02f0523d22820bc351..75c013f04a14def27176d4b33f9542b83eb2691c 100644 --- a/module/VuFind/src/VuFind/Autocomplete/PluginManager.php +++ b/module/VuFind/src/VuFind/Autocomplete/PluginManager.php @@ -46,6 +46,8 @@ class PluginManager extends \VuFind\ServiceManager\AbstractPluginManager protected $aliases = [ 'none' => 'VuFind\Autocomplete\None', 'oclcidentities' => 'VuFind\Autocomplete\OCLCIdentities', + 'search2' => 'VuFind\Autocomplete\Search2', + 'search2cn' => 'VuFind\Autocomplete\Search2CN', 'solr' => 'VuFind\Autocomplete\Solr', 'solrauth' => 'VuFind\Autocomplete\SolrAuth', 'solrcn' => 'VuFind\Autocomplete\SolrCN', @@ -70,6 +72,8 @@ class PluginManager extends \VuFind\ServiceManager\AbstractPluginManager 'VuFind\Autocomplete\None' => 'Zend\ServiceManager\Factory\InvokableFactory', 'VuFind\Autocomplete\OCLCIdentities' => 'Zend\ServiceManager\Factory\InvokableFactory', + 'VuFind\Autocomplete\Search2' => 'VuFind\Autocomplete\SolrFactory', + 'VuFind\Autocomplete\Search2CN' => 'VuFind\Autocomplete\SolrFactory', 'VuFind\Autocomplete\Solr' => 'VuFind\Autocomplete\SolrFactory', 'VuFind\Autocomplete\SolrAuth' => 'VuFind\Autocomplete\SolrFactory', 'VuFind\Autocomplete\SolrCN' => 'VuFind\Autocomplete\SolrFactory', diff --git a/module/VuFind/src/VuFind/Autocomplete/Search2.php b/module/VuFind/src/VuFind/Autocomplete/Search2.php new file mode 100644 index 0000000000000000000000000000000000000000..cdad6dbe5f95e899469cab34a5aa3b23d1bde3a6 --- /dev/null +++ b/module/VuFind/src/VuFind/Autocomplete/Search2.php @@ -0,0 +1,50 @@ +<?php +/** + * Search2 Autocomplete Module + * + * PHP version 7 + * + * Copyright (C) Villanova University 2018. + * + * 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 VuFind + * @package Autocomplete + * @author Demian Katz <demian.katz@villanova.edu> + * @author Chris Hallberg <challber@villanova.edu> + * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License + * @link https://vufind.org/wiki/development:plugins:autosuggesters Wiki + */ +namespace VuFind\Autocomplete; + +/** + * Search2 Autocomplete Module + * + * This class provides suggestions by using the secondary Solr index. + * + * @category VuFind + * @package Autocomplete + * @author Demian Katz <demian.katz@villanova.edu> + * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License + * @link https://vufind.org/wiki/development:plugins:autosuggesters Wiki + */ +class Search2 extends Solr +{ + /** + * Search object family to use + * + * @var string + */ + protected $searchClassId = 'Search2'; +} diff --git a/module/VuFind/src/VuFind/Autocomplete/Search2CN.php b/module/VuFind/src/VuFind/Autocomplete/Search2CN.php new file mode 100644 index 0000000000000000000000000000000000000000..2c3b60fd0664e62c865d4c313cb910508fb477bc --- /dev/null +++ b/module/VuFind/src/VuFind/Autocomplete/Search2CN.php @@ -0,0 +1,48 @@ +<?php +/** + * Search2 Call Number Autocomplete Module + * + * PHP version 7 + * + * Copyright (C) Villanova University 2018. + * + * 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 VuFind + * @package Autocomplete + * @author Demian Katz <demian.katz@villanova.edu> + * @author Chris Hallberg <challber@villanova.edu> + * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License + * @link https://vufind.org/wiki/development:plugins:autosuggesters Wiki + */ +namespace VuFind\Autocomplete; + +/** + * Search2 Call Number Autocomplete Module + * + * @category VuFind + * @package Autocomplete + * @author Demian Katz <demian.katz@villanova.edu> + * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License + * @link https://vufind.org/wiki/development:plugins:autosuggesters Wiki + */ +class Search2CN extends SolrCN +{ + /** + * Search object family to use + * + * @var string + */ + protected $searchClassId = 'Search2'; +} diff --git a/module/VuFind/src/VuFind/Controller/Search2Controller.php b/module/VuFind/src/VuFind/Controller/Search2Controller.php new file mode 100644 index 0000000000000000000000000000000000000000..c7b3907ac76dbd7785069eb6cacb98b2d969e05f --- /dev/null +++ b/module/VuFind/src/VuFind/Controller/Search2Controller.php @@ -0,0 +1,67 @@ +<?php + +/** + * Search2 Controller + * + * PHP version 7 + * + * Copyright (C) Staats- und Universitätsbibliothek Hamburg 2018. + * + * 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 VuFind + * @package Controller + * @author Hajo Seng <hajo.seng@sub.uni-hamburg.de> + * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License + * @link https://vufind.org Main Page + */ +namespace VuFind\Controller; + +use Zend\ServiceManager\ServiceLocatorInterface; + +/** + * Search2 Controller + * + * @category VuFind + * @package Controller + * @author Hajo Seng <hajo.seng@sub.uni-hamburg.de> + * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License + * @link https://vufind.org Main Site + */ +class Search2Controller extends AbstractSolrSearch +{ + /** + * Constructor + * + * @param ServiceLocatorInterface $sm Service locator + */ + public function __construct(ServiceLocatorInterface $sm) + { + $this->searchClassId = 'Search2'; + parent::__construct($sm); + } + + /** + * Is the result scroller active? + * + * @return bool + */ + protected function resultScrollerActive() + { + $config = $this->serviceLocator->get('VuFind\Config') + ->get('Search2'); + return isset($config->Record->next_prev_navigation) + && $config->Record->next_prev_navigation; + } +} diff --git a/module/VuFind/src/VuFind/Controller/Search2recordController.php b/module/VuFind/src/VuFind/Controller/Search2recordController.php new file mode 100644 index 0000000000000000000000000000000000000000..479ead7f1edd855059e74b7b9ec93e1b2c840e0b --- /dev/null +++ b/module/VuFind/src/VuFind/Controller/Search2recordController.php @@ -0,0 +1,68 @@ +<?php + +/** + * Search2 Record Controller + * + * PHP version 7 + * + * Copyright (C) Staats- und Universitätsbibliothek Hamburg 2018. + * + * 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 VuFind + * @package Controller + * @author Hajo Seng <hajo.seng@sub.uni-hamburg.de> + * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License + * @link https://vufind.org Main Page + */ +namespace VuFind\Controller; + +use Zend\ServiceManager\ServiceLocatorInterface; + +/** + * Search2 Record Controller + * + * @category VuFind + * @package Controller + * @author Hajo Seng <hajo.seng@sub.uni-hamburg.de> + * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License + * @link https://vufind.org Main Site + */ +class Search2recordController extends AbstractRecord +{ + /** + * Constructor + * + * @param ServiceLocatorInterface $sm Service locator + */ + public function __construct(ServiceLocatorInterface $sm) + { + $this->searchClassId = 'Search2'; + $this->fallbackDefaultTab = 'Description'; + parent::__construct($sm); + } + + /** + * Is the result scroller active? + * + * @return bool + */ + protected function resultScrollerActive() + { + $config = $this->serviceLocator->get('VuFind\Config') + ->get('Search2'); + return isset($config->Record->next_prev_navigation) + && $config->Record->next_prev_navigation; + } +} diff --git a/module/VuFind/src/VuFind/Search/BackendRegistry.php b/module/VuFind/src/VuFind/Search/BackendRegistry.php index 94699f359b8ede1c587865be1078532c2c9bd1b5..fad454710ad714020e5abb73678b4d5d221f26db 100644 --- a/module/VuFind/src/VuFind/Search/BackendRegistry.php +++ b/module/VuFind/src/VuFind/Search/BackendRegistry.php @@ -65,6 +65,7 @@ class BackendRegistry extends \VuFind\ServiceManager\AbstractPluginManager 'LibGuides' => 'VuFind\Search\Factory\LibGuidesBackendFactory', 'Pazpar2' => 'VuFind\Search\Factory\Pazpar2BackendFactory', 'Primo' => 'VuFind\Search\Factory\PrimoBackendFactory', + 'Search2' => 'VuFind\Search\Factory\Search2BackendFactory', 'Solr' => 'VuFind\Search\Factory\SolrDefaultBackendFactory', 'SolrAuth' => 'VuFind\Search\Factory\SolrAuthBackendFactory', 'SolrReserves' => 'VuFind\Search\Factory\SolrReservesBackendFactory', diff --git a/module/VuFind/src/VuFind/Search/FacetCache/PluginManager.php b/module/VuFind/src/VuFind/Search/FacetCache/PluginManager.php index d2aa8950ea628c4b9593f49874e9acf022162e8a..ca902cb6675be571aeeeaf52ebadfd1f3bb20d17 100644 --- a/module/VuFind/src/VuFind/Search/FacetCache/PluginManager.php +++ b/module/VuFind/src/VuFind/Search/FacetCache/PluginManager.php @@ -44,6 +44,7 @@ class PluginManager extends \VuFind\ServiceManager\AbstractPluginManager * @var array */ protected $aliases = [ + 'search2' => 'VuFind\Search\Search2\FacetCache', 'solr' => 'VuFind\Search\Solr\FacetCache', 'summon' => 'VuFind\Search\Summon\FacetCache', ]; @@ -54,6 +55,7 @@ class PluginManager extends \VuFind\ServiceManager\AbstractPluginManager * @var array */ protected $factories = [ + 'VuFind\Search\Search2\FacetCache' => 'VuFind\Search\Solr\FacetCacheFactory', 'VuFind\Search\Solr\FacetCache' => 'VuFind\Search\Solr\FacetCacheFactory', 'VuFind\Search\Summon\FacetCache' => 'VuFind\Search\Base\FacetCacheFactory', ]; diff --git a/module/VuFind/src/VuFind/Search/Factory/Search2BackendFactory.php b/module/VuFind/src/VuFind/Search/Factory/Search2BackendFactory.php new file mode 100644 index 0000000000000000000000000000000000000000..d8fd2cb5587365ce0fd6c0aac2ea726ab501e910 --- /dev/null +++ b/module/VuFind/src/VuFind/Search/Factory/Search2BackendFactory.php @@ -0,0 +1,50 @@ +<?php + +/** + * Factory for a second Solr backend + * + * PHP version 7 + * + * Copyright (C) Staats- und Universitätsbibliothek Hamburg 2018. + * + * 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 VuFind + * @package Search_Factory + * @author Hajo Seng <hajo.seng@sub.uni-hamburg.de> + * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License + * @link https://vufind.org Main Site + */ +namespace VuFind\Search\Factory; + +/** + * Factory for a second Solr backend + * + * @category VuFind + * @package Search_Factory + * @author Hajo Seng <hajo.seng@sub.uni-hamburg.de> + * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License + * @link https://vufind.org Main Site + */ +class Search2BackendFactory extends SolrDefaultBackendFactory +{ + /** + * Constructor + */ + public function __construct() + { + parent::__construct(); + $this->mainConfig = $this->searchConfig = $this->facetConfig = 'Search2'; + } +} diff --git a/module/VuFind/src/VuFind/Search/Options/PluginManager.php b/module/VuFind/src/VuFind/Search/Options/PluginManager.php index d62266e3304026141a559763b28a9bed2fa8400d..7522a644e56c847511e5a9367eed02ba4d8ccc92 100644 --- a/module/VuFind/src/VuFind/Search/Options/PluginManager.php +++ b/module/VuFind/src/VuFind/Search/Options/PluginManager.php @@ -54,6 +54,7 @@ class PluginManager extends \VuFind\ServiceManager\AbstractPluginManager 'mixedlist' => 'VuFind\Search\MixedList\Options', 'pazpar2' => 'VuFind\Search\Pazpar2\Options', 'primo' => 'VuFind\Search\Primo\Options', + 'search2' => 'VuFind\Search\Search2\Options', 'solr' => 'VuFind\Search\Solr\Options', 'solrauth' => 'VuFind\Search\SolrAuth\Options', 'solrauthor' => 'VuFind\Search\SolrAuthor\Options', @@ -82,6 +83,7 @@ class PluginManager extends \VuFind\ServiceManager\AbstractPluginManager 'VuFind\Search\MixedList\Options' => 'VuFind\Search\Options\OptionsFactory', 'VuFind\Search\Pazpar2\Options' => 'VuFind\Search\Options\OptionsFactory', 'VuFind\Search\Primo\Options' => 'VuFind\Search\Options\OptionsFactory', + 'VuFind\Search\Search2\Options' => 'VuFind\Search\Options\OptionsFactory', 'VuFind\Search\Solr\Options' => 'VuFind\Search\Options\OptionsFactory', 'VuFind\Search\SolrAuth\Options' => 'VuFind\Search\Options\OptionsFactory', 'VuFind\Search\SolrAuthor\Options' => 'VuFind\Search\Options\OptionsFactory', diff --git a/module/VuFind/src/VuFind/Search/Params/PluginManager.php b/module/VuFind/src/VuFind/Search/Params/PluginManager.php index e78b79f77b9e2cbffc77f838087e6be6629c3a08..d26e0db888d4850f152541f3f434f250925df82a 100644 --- a/module/VuFind/src/VuFind/Search/Params/PluginManager.php +++ b/module/VuFind/src/VuFind/Search/Params/PluginManager.php @@ -54,6 +54,7 @@ class PluginManager extends \VuFind\ServiceManager\AbstractPluginManager 'mixedlist' => 'VuFind\Search\MixedList\Params', 'pazpar2' => 'VuFind\Search\Pazpar2\Params', 'primo' => 'VuFind\Search\Primo\Params', + 'search2' => 'VuFind\Search\Search2\Params', 'solr' => 'VuFind\Search\Solr\Params', 'solrauth' => 'VuFind\Search\SolrAuth\Params', 'solrauthor' => 'VuFind\Search\SolrAuthor\Params', @@ -82,6 +83,7 @@ class PluginManager extends \VuFind\ServiceManager\AbstractPluginManager 'VuFind\Search\MixedList\Params' => 'VuFind\Search\Params\ParamsFactory', 'VuFind\Search\Pazpar2\Params' => 'VuFind\Search\Params\ParamsFactory', 'VuFind\Search\Primo\Params' => 'VuFind\Search\Params\ParamsFactory', + 'VuFind\Search\Search2\Params' => 'VuFind\Search\Solr\ParamsFactory', 'VuFind\Search\Solr\Params' => 'VuFind\Search\Solr\ParamsFactory', 'VuFind\Search\SolrAuth\Params' => 'VuFind\Search\Params\ParamsFactory', 'VuFind\Search\SolrAuthor\Params' => 'VuFind\Search\Params\ParamsFactory', diff --git a/module/VuFind/src/VuFind/Search/Results/PluginManager.php b/module/VuFind/src/VuFind/Search/Results/PluginManager.php index 18ef86f9562f276a0ec9e3f019ba2f182db0d289..4585f59a0801c6ca147f9c0e5ddb5d3ca0ffc548 100644 --- a/module/VuFind/src/VuFind/Search/Results/PluginManager.php +++ b/module/VuFind/src/VuFind/Search/Results/PluginManager.php @@ -54,6 +54,7 @@ class PluginManager extends \VuFind\ServiceManager\AbstractPluginManager 'mixedlist' => 'VuFind\Search\MixedList\Results', 'pazpar2' => 'VuFind\Search\Pazpar2\Results', 'primo' => 'VuFind\Search\Primo\Results', + 'search2' => 'VuFind\Search\Search2\Results', 'solr' => 'VuFind\Search\Solr\Results', 'solrauth' => 'VuFind\Search\SolrAuth\Results', 'solrauthor' => 'VuFind\Search\SolrAuthor\Results', @@ -83,6 +84,7 @@ class PluginManager extends \VuFind\ServiceManager\AbstractPluginManager 'VuFind\Search\MixedList\Results' => 'VuFind\Search\Results\ResultsFactory', 'VuFind\Search\Pazpar2\Results' => 'VuFind\Search\Results\ResultsFactory', 'VuFind\Search\Primo\Results' => 'VuFind\Search\Results\ResultsFactory', + 'VuFind\Search\Search2\Results' => 'VuFind\Search\Search2\ResultsFactory', 'VuFind\Search\Solr\Results' => 'VuFind\Search\Solr\ResultsFactory', 'VuFind\Search\SolrAuth\Results' => 'VuFind\Search\Results\ResultsFactory', 'VuFind\Search\SolrAuthor\Results' => 'VuFind\Search\Results\ResultsFactory', diff --git a/module/VuFind/src/VuFind/Search/Search2/FacetCache.php b/module/VuFind/src/VuFind/Search/Search2/FacetCache.php new file mode 100644 index 0000000000000000000000000000000000000000..2ccc8cf9e465e084c0b5a48f89e9ba928eae706e --- /dev/null +++ b/module/VuFind/src/VuFind/Search/Search2/FacetCache.php @@ -0,0 +1,50 @@ +<?php +/** + * Search2 FacetCache. + * + * PHP version 7 + * + * Copyright (C) Villanova University 2018. + * + * 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 VuFind + * @package Search_Search2 + * @author Demian Katz <demian.katz@villanova.edu> + * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License + * @link https://vufind.org/wiki/development Wiki + */ +namespace VuFind\Search\Search2; + +/** + * Search2 FacetCache. + * + * @category VuFind + * @package Search_Search2 + * @author Demian Katz <demian.katz@villanova.edu> + * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License + * @link https://vufind.org/wiki/development Wiki + */ +class FacetCache extends \VuFind\Search\Base\FacetCache +{ + /** + * Get the namespace to use for caching facets. + * + * @return string + */ + protected function getCacheNamespace() + { + return 'search2-facets'; + } +} diff --git a/module/VuFind/src/VuFind/Search/Search2/Options.php b/module/VuFind/src/VuFind/Search/Search2/Options.php new file mode 100644 index 0000000000000000000000000000000000000000..7089af07a33f3667273befe117944dd37347658d --- /dev/null +++ b/module/VuFind/src/VuFind/Search/Search2/Options.php @@ -0,0 +1,73 @@ +<?php + +/** + * Search Options for second Solr index + * + * PHP version 7 + * + * Copyright (C) Staats- und Universitätsbibliothek Hamburg 2018. + * + * 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 VuFind + * @package Search_Search2 + * @author Hajo Seng <hajo.seng@sub.uni-hamburg.de> + * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License + * @link https://vufind.org Main Page + */ +namespace VuFind\Search\Search2; + +/** + * Search Options for second Solr index + * + * @category VuFind + * @package Search_Search2 + * @author Hajo Seng <hajo.seng@sub.uni-hamburg.de> + * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License + * @link https://vufind.org Main Site + */ +class Options extends \VuFind\Search\Solr\Options +{ + /** + * Constructor + * + * @param \VuFind\Config\PluginManager $configLoader Config loader + */ + public function __construct(\VuFind\Config\PluginManager $configLoader) + { + $this->mainIni = $this->searchIni = $this->facetsIni = 'Search2'; + parent::__construct($configLoader); + } + + /** + * Return the route name for the search results action. + * + * @return string + */ + public function getSearchAction() + { + return 'search2-results'; + } + + /** + * Return the route name of the action used for performing advanced searches. + * Returns false if the feature is not supported. + * + * @return string|bool + */ + public function getAdvancedSearchAction() + { + return 'search2-advanced'; + } +} diff --git a/module/VuFind/src/VuFind/Search/Search2/Params.php b/module/VuFind/src/VuFind/Search/Search2/Params.php new file mode 100644 index 0000000000000000000000000000000000000000..a139cb3f3404dbaf4c4cf38f00abc67fb3ea013a --- /dev/null +++ b/module/VuFind/src/VuFind/Search/Search2/Params.php @@ -0,0 +1,64 @@ +<?php + +/** + * Search Params for second Solr index + * + * PHP version 7 + * + * Copyright (C) Staats- und Universitätsbibliothek Hamburg 2018. + * + * 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 VuFind + * @package Search_Search2 + * @author Hajo Seng <hajo.seng@sub.uni-hamburg.de> + * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License + * @link https://vufind.org Main Page + */ +namespace VuFind\Search\Search2; + +/** + * Search Params for second Solr index + * + * @category VuFind + * @package Search_Search2 + * @author Hajo Seng <hajo.seng@sub.uni-hamburg.de> + * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License + * @link https://vufind.org Main Site + */ +class Params extends \VuFind\Search\Solr\Params +{ + /** + * Initialize facet settings for the advanced search screen. + * + * @return void + */ + public function initAdvancedFacets() + { + $this->initFacetList('Advanced_Facets', 'Advanced_Settings'); + } + + /** + * Initialize facet settings for the home page. + * + * @return void + */ + public function initHomePageFacets() + { + // Load Advanced settings if HomePage settings are missing (legacy support): + if (!$this->initFacetList('HomePage_Facets', 'HomePage_Facet_Settings')) { + $this->initAdvancedFacets(); + } + } +} diff --git a/module/VuFind/src/VuFind/Search/Search2/Results.php b/module/VuFind/src/VuFind/Search/Search2/Results.php new file mode 100644 index 0000000000000000000000000000000000000000..63205d0a948d36151d3991017c9cbaccfce91c47 --- /dev/null +++ b/module/VuFind/src/VuFind/Search/Search2/Results.php @@ -0,0 +1,48 @@ +<?php + +/** + * Search Results for second Solr index + * + * PHP version 7 + * + * Copyright (C) Staats- und Universitätsbibliothek Hamburg 2018. + * + * 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 VuFind + * @package Search_Search2 + * @author Hajo Seng <hajo.seng@sub.uni-hamburg.de> + * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License + * @link https://vufind.org Main Page + */ +namespace VuFind\Search\Search2; + +/** + * Search Results for second Solr index + * + * @category VuFind + * @package Search_Search2 + * @author Hajo Seng <hajo.seng@sub.uni-hamburg.de> + * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License + * @link https://vufind.org Main Site + */ +class Results extends \VuFind\Search\Solr\Results +{ + /** + * Backend ID + * + * @var string + */ + protected $backendId = 'Search2'; +} diff --git a/module/VuFind/src/VuFind/Search/Search2/ResultsFactory.php b/module/VuFind/src/VuFind/Search/Search2/ResultsFactory.php new file mode 100644 index 0000000000000000000000000000000000000000..11d75b5bfb02dff20485d29f9a47ada40f342c3a --- /dev/null +++ b/module/VuFind/src/VuFind/Search/Search2/ResultsFactory.php @@ -0,0 +1,67 @@ +<?php +/** + * Factory for Search2 results objects. + * + * PHP version 7 + * + * Copyright (C) Villanova University 2018. + * + * 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 VuFind + * @package Search_Search2 + * @author Demian Katz <demian.katz@villanova.edu> + * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License + * @link https://vufind.org/wiki/development Wiki + */ +namespace VuFind\Search\Search2; + +use Interop\Container\ContainerInterface; + +/** + * Factory for Search2 results objects. + * + * @category VuFind + * @package Search_Search2 + * @author Demian Katz <demian.katz@villanova.edu> + * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License + * @link https://vufind.org/wiki/development Wiki + */ +class ResultsFactory extends \VuFind\Search\Results\ResultsFactory +{ + /** + * Create an object + * + * @param ContainerInterface $container Service manager + * @param string $requestedName Service being created + * @param null|array $options Extra options (optional) + * + * @return object + * + * @throws ServiceNotFoundException if unable to resolve the service. + * @throws ServiceNotCreatedException if an exception is raised when + * creating a service. + * @throws ContainerException if any other error occurs + */ + public function __invoke(ContainerInterface $container, $requestedName, + array $options = null + ) { + $solr = parent::__invoke($container, $requestedName, $options); + $config = $container->get('VuFind\Config\PluginManager')->get('Search2'); + $solr->setSpellingProcessor( + new \VuFind\Search\Solr\SpellingProcessor($config->Spelling ?? null) + ); + return $solr; + } +} diff --git a/themes/bootstrap3/templates/search2/advanced.phtml b/themes/bootstrap3/templates/search2/advanced.phtml new file mode 100644 index 0000000000000000000000000000000000000000..90c56be5520a3d28d64a311f83c0ecd314e33d68 --- /dev/null +++ b/themes/bootstrap3/templates/search2/advanced.phtml @@ -0,0 +1 @@ +<?=$this->render('search/advanced.phtml'); ?> diff --git a/themes/bootstrap3/templates/search2/home.phtml b/themes/bootstrap3/templates/search2/home.phtml new file mode 100644 index 0000000000000000000000000000000000000000..bc5b700660ea8e7baee8cc01de0600b0b4611521 --- /dev/null +++ b/themes/bootstrap3/templates/search2/home.phtml @@ -0,0 +1 @@ +<?=$this->render('search/home.phtml');?> diff --git a/themes/bootstrap3/templates/search2/results.phtml b/themes/bootstrap3/templates/search2/results.phtml new file mode 100644 index 0000000000000000000000000000000000000000..1d94458550eb5622deb7fe9df430fa693c66393f --- /dev/null +++ b/themes/bootstrap3/templates/search2/results.phtml @@ -0,0 +1 @@ +<?=$this->render('search/results.phtml'); ?>