-
Notifications
You must be signed in to change notification settings - Fork 359
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add backend: ProQuest Federated Search Gateway (#3991)
- Loading branch information
1 parent
feaa67e
commit cd84956
Showing
52 changed files
with
3,101 additions
and
156 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,170 @@ | ||
; This section contains global settings affecting search behavior. | ||
; For ProQuest Federated Search Gateway API documentation: | ||
; https://support.proquest.com/s/article/ProQuest-Academic-Platform-Federated-Search-Options | ||
[General] | ||
; Enable the ProQuest Federated Search Gateway integration. Disabled by default. | ||
;enabled = true | ||
|
||
; This setting controls the default sort order of search results; the selected | ||
; option should be one of the options present in the [Sorting] section below. | ||
default_sort = relevance | ||
; This section controls the result limit options for search results. default_limit | ||
; sets the default number of results per page. limit_options is a comma-separated | ||
; list of numbers to be presented to the end-user. If only one limit is required, | ||
; set default_limit and leave limit_options commented out. | ||
; WARNING: using large limits may cause problems due to a variety of limitations, | ||
; especially if you support bulk operations (which can cause large URLs/requests). | ||
; If you must support large page sizes, you may need to raise the PHP memory_limit | ||
; and max_input_vars settings and/or adjust the Apache LimitRequestLine setting. | ||
default_limit = 20 | ||
; limit_options = 10,20,40,60,80,100 | ||
|
||
; This setting allows to limit pagination of a search result as deep pagination | ||
; costs a lot of performance and most users are not very likely to navigate | ||
; further down than 20 pages of a search result. | ||
; This is especially useful to prevent webcrawlers from descending too deep and | ||
; eating up search backend performance. | ||
; Default is 400; the API supports a maximum limit of 1000. | ||
;result_limit = 400 | ||
|
||
; These are the default recommendations modules to use when no specific setting | ||
; are found in the [TopRecommendations], [SideRecommendations] or | ||
; [NoResultsRecommendations] sections below. | ||
; See the comments above those sections for details on legal settings. You may | ||
; repeat these lines to load multiple recommendations. | ||
default_side_recommend[] = SideFacets:Facets:CheckboxFacets:ProQuestFSG | ||
;default_noresults_recommend[] = SwitchTab | ||
default_noresults_recommend[] = RemoveFilters | ||
|
||
; When you filter a search using facets, should VuFind retain your current filters | ||
; on the next search and provide a reset button to clear them (true), or should it | ||
; always perform new searches unfiltered (false)? | ||
retain_filters_by_default = true | ||
|
||
; Whether to always (when there are active filters) display the "Reset Filters" | ||
; button regardless of the retain_filters_by_default setting. Default is false. | ||
always_display_reset_filters = false | ||
|
||
; This controls whether results are loaded with JavaScript when paging or changing | ||
; settings. Loading results this way improves performance and accessibility, and is | ||
; enabled by default. Loading will automatically fall back to non-JS mode if | ||
; JavaScript is not supported by the browser. | ||
load_results_with_js = true | ||
|
||
; This setting can be used to configure pagination control on top of results. | ||
; Possible options are: | ||
; empty string or false No top pagination (default) | ||
; simple Simple next/prev button pagination | ||
; full Full pagination alike to the one at the bottom of results | ||
;top_paginator = simple | ||
|
||
; The following two sections can be used to associate specific recommendations | ||
; modules with specific search types defined in the [Basic_Searches] section | ||
; below. For all the details on how these sections work, see the comments above | ||
; the equivalent sections of searches.ini. Recommendations work the same in | ||
; ProQuestFSG as they do in the regular Search module. | ||
;[SideRecommendations] | ||
; No search-specific settings by default -- add your own here. | ||
;[TopRecommendations] | ||
; No search-specific settings by default -- add your own here. | ||
|
||
; The order of display is as shown below | ||
; The name of the index field is on the left | ||
; The display name of the field is on the right | ||
[Facets] | ||
Databases = "Source" | ||
|
||
; This section is reserved for special boolean facets. These are displayed | ||
; as checkboxes. If the box is checked, the filter on the left side of the | ||
; equal sign is applied. If the box is not checked, the filter is not applied. | ||
; The value on the right side of the equal sign is the text to display to the | ||
; user . It will be run through the translation code, so be sure to update the | ||
; language files appropriately. | ||
[CheckboxFacets] | ||
limitFullText = "fulltext_limit" | ||
limitScholarlyJournals = "scholarly_limit" | ||
limitPeerReviewed = "peer_reviewed_limit" | ||
|
||
; Facet display settings | ||
[Results_Settings] | ||
; By default, the side facets will only show 6 facets and then the "show more" | ||
; button. This can get configured with the showMore settings. | ||
; You can use the * to set a new default setting. | ||
showMore[*] = 6 | ||
; Or you can set a facet specific value by using the facet name as index. | ||
;showMore['rtype'] = 10 | ||
; Do we want any facets to be collapsed by default? | ||
;collapsedFacets = * | ||
|
||
; This section shows which search types will display in the basic search box at | ||
; the top of ProQuest pages. The name of each setting below corresponds with an | ||
; index defined in the ProQuestFSG API. The value of each setting is the text to | ||
; display on screen. All on-screen text will be run through the translator, so | ||
; be sure to update language files if necessary. The order of these settings | ||
; will be maintained in the drop-down list in the UI. | ||
[Basic_Searches] | ||
cql.serverChoice = "All Fields" | ||
title = Title | ||
author = Author | ||
subject = Subject | ||
publication = Journal Title | ||
;abstract = Abstract | ||
|
||
; This section defines which search options will be included on the advanced | ||
; search screen. All the notes above [Basic_Searches] also apply here. | ||
[Advanced_Searches] | ||
cql.serverChoice = "All Fields" | ||
title = Title | ||
author = Author | ||
subject = Subject | ||
publication = Journal Title | ||
;abstract = Abstract | ||
|
||
; This section defines the sort options available on search results. | ||
[Sorting] | ||
relevance = sort_relevance | ||
date/descending = sort_year | ||
date/ascending = sort_year_asc | ||
|
||
; This section allows you to specify hidden sorting options. They can be used to create a | ||
|
||
; This section controls the behavior of the ProQuestFSGRecord module. | ||
[Record] | ||
; Set this to true in order to enable "next" and "previous" links to navigate | ||
; through the current result set from within the record view. | ||
next_prev_navigation = false | ||
|
||
; This section controls what happens when a record title in a search result list | ||
; is clicked. VuFind can either embed the full result directly in the list using | ||
; AJAX or can display it at its own separate URL as a full HTML page. | ||
; full - separate page (default) | ||
; tabs - embedded using tabs (see record/tabs.phtml) | ||
; accordion - embedded using an accordion (see record/accordion.phtml) | ||
; NOTE: To turn this feature on for favorite lists, see the lists_view setting | ||
; in the [Social] section of config.ini. | ||
; NOTE: This feature is incompatible with SyndeticsPlus content; please use | ||
; regular Syndetics if necessary. | ||
[List] | ||
view=full | ||
|
||
; This section provides settings for optional caching of search requests. | ||
[SearchCache] | ||
; Supported adapters: Memcached, Filesystem. Others may also work, but have not been | ||
; tested. | ||
;adapter = Memcached | ||
; Comma-separated list of servers for Memcached adapter: | ||
;options[servers] = "localhost:11211" | ||
; Cache directory for Filesystem adapter: | ||
;options[cache_dir] = "/tmp/search-cache" | ||
; Other options. See https://docs.laminas.dev/laminas-cache/storage/adapter/ for | ||
; documentation on options for different adapters. | ||
; ttl, Time to Live, i.e. cache entry life time in seconds. 300 seconds by default. | ||
;options[ttl] = 300 | ||
|
||
; This example section provides filters for the ProQuestFSGResults recommendation | ||
; module. The section name is specified in the recommendation module config. | ||
; [ProQuestFSGResultsDissertationsFilter] | ||
|
||
; Filters are defined as in [RawHiddenFilters] in order to handle more complex | ||
; filter combinations. | ||
; 0 = "Databases:pqdtglobal1" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
81 changes: 81 additions & 0 deletions
81
module/VuFind/src/VuFind/Controller/Feature/CheckEnabledTrait.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
<?php | ||
|
||
/** | ||
* Check Enabled Trait | ||
* | ||
* PHP version 8 | ||
* | ||
* Copyright (C) Villanova University 2024. | ||
* | ||
* 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_Plugins | ||
* @author Maccabee Levine <[email protected]> | ||
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License | ||
* @link https://vufind.org Main Page | ||
*/ | ||
|
||
namespace VuFind\Controller\Feature; | ||
|
||
use Laminas\Mvc\MvcEvent; | ||
use VuFind\Exception\Forbidden as ForbiddenException; | ||
|
||
/** | ||
* Check Enabled Trait | ||
* | ||
* @category VuFind | ||
* @package Controller_Plugins | ||
* @author Maccabee Levine <[email protected]> | ||
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License | ||
* @link https://vufind.org Main Page | ||
*/ | ||
trait CheckEnabledTrait | ||
{ | ||
/** | ||
* Check whether the controller is enabled | ||
* | ||
* @return void | ||
* | ||
* @throws ForbiddenException if the controller is not enabled | ||
*/ | ||
protected function checkEnabled() | ||
{ | ||
$configId = $this->searchClassId ?? $this->sourceId ?? null; | ||
if (!$configId) { | ||
return; | ||
} | ||
|
||
$config = $this->getConfig($configId); | ||
if (!($config['General']['enabled'] ?? false)) { | ||
throw new ForbiddenException($configId . ' is disabled'); | ||
} | ||
} | ||
|
||
/** | ||
* Add to event listeners a check that the controller is enabled | ||
* | ||
* @return void | ||
*/ | ||
protected function attachDefaultListeners() | ||
{ | ||
parent::attachDefaultListeners(); | ||
$events = $this->getEventManager(); | ||
$events->attach( | ||
MvcEvent::EVENT_DISPATCH, | ||
fn () => $this->checkEnabled(), | ||
1000 | ||
); | ||
} | ||
} |
71 changes: 71 additions & 0 deletions
71
module/VuFind/src/VuFind/Controller/ProQuestFSGController.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
<?php | ||
|
||
/** | ||
* ProQuest Federated Search Gateway Controller | ||
* | ||
* PHP version 8 | ||
* | ||
* Copyright (C) Villanova University 2024. | ||
* | ||
* 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 Demian Katz <[email protected]> | ||
* @author Maccabee Levine <[email protected]> | ||
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License | ||
* @link https://vufind.org Main Site | ||
*/ | ||
|
||
namespace VuFind\Controller; | ||
|
||
use Laminas\ServiceManager\ServiceLocatorInterface; | ||
use VuFind\Controller\Feature\CheckEnabledTrait; | ||
|
||
/** | ||
* ProQuest Federated Search Gateway Controller | ||
* | ||
* @category VuFind | ||
* @package Controller | ||
* @author Demian Katz <[email protected]> | ||
* @author Maccabee Levine <[email protected]> | ||
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License | ||
* @link https://vufind.org Main Site | ||
*/ | ||
class ProQuestFSGController extends AbstractSearch | ||
{ | ||
use CheckEnabledTrait; | ||
|
||
/** | ||
* Constructor | ||
* | ||
* @param ServiceLocatorInterface $sm Service locator | ||
*/ | ||
public function __construct(ServiceLocatorInterface $sm) | ||
{ | ||
$this->searchClassId = 'ProQuestFSG'; | ||
parent::__construct($sm); | ||
} | ||
|
||
/** | ||
* Is the result scroller active? | ||
* | ||
* @return bool | ||
*/ | ||
protected function resultScrollerActive() | ||
{ | ||
$config = $this->getService(\VuFind\Config\PluginManager::class)->get('ProQuestFSG'); | ||
return $config->Record->next_prev_navigation ?? false; | ||
} | ||
} |
Oops, something went wrong.