diff --git a/build/appConfig.js.template b/build/appConfig.js.template index e7aabd6c..4e8897a8 100644 --- a/build/appConfig.js.template +++ b/build/appConfig.js.template @@ -61,6 +61,12 @@ var appConfig = { 'defaultThumbnailURI': "resources/images/default-thumbnail.jpg", 'defaultLoadingThumbnailURI': "resources/images/loading2.gif", - 'avalonUrl': '${AVALON_URL}' - + 'avalonUrl': '${AVALON_URL}', + 'searchHelpManageUrl': 'https://github.com/TAMULib/SAGE/wiki/Searching', + 'searchHelpDismaxAndUrl': 'https://github.com/TAMULib/SAGE/wiki/Search-Syntax-Using-Dismax-And', + 'searchHelpDismaxOrUrl': 'https://github.com/TAMULib/SAGE/wiki/Search-Syntax-Using-Dismax-Or', + 'searchHelpEdismaxAndUrl': 'https://github.com/TAMULib/SAGE/wiki/Search-Syntax-Using-Edismax-And', + 'searchHelpEdismaxOrUrl': 'https://github.com/TAMULib/SAGE/wiki/Search-Syntax-Using-Edismax-Or', + 'searchHelpLuceneAndUrl': 'https://github.com/TAMULib/SAGE/wiki/Search-Syntax-Using-Lucene-And', + 'searchHelpLuceneOrUrl': 'https://github.com/TAMULib/SAGE/wiki/Search-Syntax-Using-Lucene-Or', }; diff --git a/src/main/webapp/app/controllers/discoveryContextController.js b/src/main/webapp/app/controllers/discoveryContextController.js index 19a721d1..a4d2bc5a 100644 --- a/src/main/webapp/app/controllers/discoveryContextController.js +++ b/src/main/webapp/app/controllers/discoveryContextController.js @@ -8,6 +8,8 @@ sage.controller('DiscoveryContextController', function ($controller, $scope, $ro $scope.defaultThumbnailURI = appConfig.defaultThumbnailURI; + $scope.searchHelpUrl = ""; + $scope.rowOptions = []; var options = [10, 25, 50, 100]; @@ -21,6 +23,26 @@ sage.controller('DiscoveryContextController', function ($controller, $scope, $ro }); $scope.discoveryContext.ready().then(function() { + $scope.isAndOperand = function() { + if (angular.isDefined($scope.discoveryContext.defaultOperand) && $scope.discoveryContext.defaultOperand == "AND") { + return true; + } + + return false; + }; + + if (angular.isDefined($scope.discoveryContext.queryParser)) { + if ($scope.discoveryContext.queryParser == "EDISMAX") { + $scope.searchHelpUrl = $scope.isAndOperand() ? appConfig.searchHelpEdismaxAndUrl : appConfig.searchHelpEdismaxOrUrl; + } + else if ($scope.discoveryContext.queryParser == "DISMAX") { + $scope.searchHelpUrl = $scope.isAndOperand() ? appConfig.searchHelpDismaxAndUrl : appConfig.searchHelpDismaxOrUrl; + } + } + + if ($scope.searchHelpUrl == "") { + $scope.searchHelpUrl = $scope.isAndOperand() ? appConfig.searchHelpLuceneAndUrl : appConfig.searchHelpLuceneOrUrl; + } // Prevent search value from being initially set as the string 'undefined'. $scope.currentSearchValue = ""; @@ -203,6 +225,10 @@ sage.controller('DiscoveryContextController', function ($controller, $scope, $ro return typeof $scope.discoveryContext.search.value === "string" && $scope.discoveryContext.search.value !== ""; }; + $scope.notAllSearch = function() { + return angular.isDefined($scope.currentSearchField) && $scope.currentSearchField.key !== "all_fields"; + }; + $scope.presentCollectionText = function(value) { return $sce.trustAsHtml(value); }; diff --git a/src/main/webapp/app/controllers/management/discoveryViewManagementController.js b/src/main/webapp/app/controllers/management/discoveryViewManagementController.js index 529c21a4..7c10ae3b 100644 --- a/src/main/webapp/app/controllers/management/discoveryViewManagementController.js +++ b/src/main/webapp/app/controllers/management/discoveryViewManagementController.js @@ -1,4 +1,4 @@ -sage.controller('DiscoveryViewManagementController', function ($controller, $scope, $timeout, DiscoveryView, DiscoveryViewRepo, FacetField, MetadataField, NgTableParams, SearchField, SourceRepo) { +sage.controller('DiscoveryViewManagementController', function ($controller, $scope, $timeout, DiscoveryView, DiscoveryViewRepo, FacetField, MetadataField, NgTableParams, SearchField, SourceRepo, appConfig) { angular.extend(this, $controller('AbstractController', { $scope: $scope @@ -17,6 +17,8 @@ sage.controller('DiscoveryViewManagementController', function ($controller, $sco $scope.queryParsers = [ "", "EDISMAX", "DISMAX" ]; $scope.queryOperands = [ "", "AND", "OR" ]; + $scope.searchHelpUrl = appConfig.searchHelpManageUrl; + $scope.fields = []; $scope.discoveryViewForms = { diff --git a/src/main/webapp/app/resources/styles/sass/discovery-context/_all.scss b/src/main/webapp/app/resources/styles/sass/discovery-context/_all.scss index 6e7b9c9e..df5a398f 100644 --- a/src/main/webapp/app/resources/styles/sass/discovery-context/_all.scss +++ b/src/main/webapp/app/resources/styles/sass/discovery-context/_all.scss @@ -143,6 +143,17 @@ height: 40px; } + .dc-search-help { + font-size: 1rem; + + .dc-search-help-link { + cursor: help; + + padding: 8px 8px; + margin: 0px 4px; + } + } + } .dc-active-filters { diff --git a/src/main/webapp/app/views/discovery/discovery-context.html b/src/main/webapp/app/views/discovery/discovery-context.html index 45e59e5d..04ab2fdc 100644 --- a/src/main/webapp/app/views/discovery/discovery-context.html +++ b/src/main/webapp/app/views/discovery/discovery-context.html @@ -60,6 +60,9 @@