Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue 494: Provide a link to a wiki page on Github regarding search help. #510

Merged
merged 5 commits into from
Jan 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions build/appConfig.js.template
Original file line number Diff line number Diff line change
Expand Up @@ -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',
};
26 changes: 26 additions & 0 deletions src/main/webapp/app/controllers/discoveryContextController.js
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand All @@ -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 = "";
Expand Down Expand Up @@ -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);
};
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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 = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down
3 changes: 3 additions & 0 deletions src/main/webapp/app/views/discovery/discovery-context.html
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@ <h3>
</select>
</span>
<input aria-labelledby="searchButton" type="text" class="form-control dc-search-input" ng-model="currentSearchValue" ng-keypress="searchProcessKeyPress($event)">
<span ng-if="notAllSearch()" class="input-group-btn dc-search-help">
<a href="{{searchHelpUrl}}" class="dc-search-help-link glyphicon glyphicon-question-sign clickable" title="Help about searching." rel="help" target="_blank"></a>
</span>
<span class="input-group-btn">
<button id="searchButton" ng-click="search()" type="button" class="btn btn-default dc-filter dc-filter-search">Search</button>
</span>
Expand Down
5 changes: 5 additions & 0 deletions src/main/webapp/app/views/modals/cloneDiscoveryViewModal.html
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,11 @@ <h4 class="modal-title">Clone Discovery View</h4>
results="discoveryViewForms.getResults()"
autocomplete="off">
</validatedselect>
<div>
View the
<a href="{{searchHelpUrl}}" class="dv-search-help-link" rel="help" target="_blank">search operands and parsers external documentation</a>
for more details.
</div>
</div>
</div>
</uib-tab>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,11 @@ <h4 class="modal-title">Create Discovery View</h4>
results="discoveryViewForms.getResults()"
autocomplete="off">
</validatedselect>
<div>
View the
<a href="{{searchHelpUrl}}" class="dv-search-help-link" rel="help" target="_blank">search operands and parsers external documentation</a>
for more details.
</div>
</div>
</div>
</uib-tab>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,11 @@ <h4 class="modal-title">Edit Discovery View</h4>
results="discoveryViewForms.getResults()"
autocomplete="off">
</validatedselect>
<div>
View the
<a href="{{searchHelpUrl}}" class="dv-search-help-link" rel="help" target="_blank">search operands and parsers external documentation</a>
for more details.
</div>
</div>
</div>
</uib-tab>
Expand Down