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

Fixes for searches, ajax, waypoints, easyrdf HTTP client errors #1197

Merged
merged 9 commits into from
Sep 9, 2021

Conversation

osma
Copy link
Member

@osma osma commented Sep 8, 2021

This is the last part of fixes split off from PR #1033. I created a new branch from master (after merging PRs #1194 #1195 #1196) and cherry-picking the last commit in PR #1033 originally created by @kouralex . Some merge conflicts were fixed, hopefully correctly - in headerbar.twig I simply discarded the change as the template had been subsequently modified in PR #1061 (adding accessibility features) and it didn't seem to apply anymore.

Original description of changes from the commit message:

fixes fore failing vocabulary/global search; fixes erroring ajax search queries; fixes waypoint system used in search; added checks for various easyrdf http client errors

…ch queries; fixes waypoint system used in search; added checks for various easyrdf http client errors

(cherry picked from commit 9f762ff)
@osma osma added the bug label Sep 8, 2021
@osma osma added this to the 2.12 milestone Sep 8, 2021
@osma osma self-assigned this Sep 8, 2021
@codecov
Copy link

codecov bot commented Sep 8, 2021

Codecov Report

Merging #1197 (ee5e40f) into master (7a570ff) will decrease coverage by 0.45%.
The diff coverage is 9.09%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master    #1197      +/-   ##
============================================
- Coverage     68.71%   68.26%   -0.46%     
- Complexity     1598     1609      +11     
============================================
  Files            32       32              
  Lines          3929     3955      +26     
============================================
  Hits           2700     2700              
- Misses         1229     1255      +26     
Impacted Files Coverage Δ
controller/WebController.php 16.15% <0.00%> (-0.62%) ⬇️
model/Model.php 80.97% <7.14%> (-2.72%) ⬇️
model/DataObject.php 67.39% <25.00%> (-10.11%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 7a570ff...ee5e40f. Read the comment docs.

Copy link
Member Author

@osma osma left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a few notes on TODO items.

More generally, we need a way to test the changes in this PR, to verify that the fixes are indeed working as they should.

controller/WebController.php Outdated Show resolved Hide resolved
resource/js/docready.js Outdated Show resolved Hide resolved
resource/js/docready.js Outdated Show resolved Hide resolved
view/search-result.twig Outdated Show resolved Hide resolved
controller/WebController.php Outdated Show resolved Hide resolved
if ($this->model->getConfig()->getLogCaughtExceptions()) {
error_log('Caught exception: ' . $e->getMessage());
}
$this->invokeGenericErrorPage($request, $e->getMessage());
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generic error page is no longer used here, as the search result page can now show a proper warning message.

$results = $exsparql->queryLabel($exuri, $lang);

return isset($results[$lang]) ? $results[$lang] : null;
try {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here the idea is to catch errors accessing labels from another vocabulary.

$exsparql = $exvoc->getSparql();
$results = $exsparql->queryNotation($exuri);
return isset($results) ? $results : null;
try {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above, but accessing notations from external vocabularies.

return $vocab;
} else {
// not found in preferred vocabulary, fall back to next method
try {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Idea here is to handle errors that happen when disambiguating between URI namespaces (e.g. is this URI from YSO or YSO Places?)

@@ -483,8 +490,16 @@ private function disambiguateVocabulary($vocabs, $uri, $preferredVocabId = null)

// no preferred vocabulary, or it was not found, search in which vocabulary the concept has a label
foreach ($vocabs as $vocab) {
if ($vocab->getConceptLabel($uri, null) !== null)
return $vocab;
try {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above, catch errors that happen when disambiguating URIs

@@ -210,7 +210,8 @@ function loadLimitedResults(parameters) {
clearResultsAndAddSpinner();
$.ajax({
data: parameters,
success : function(data) {
complete : function(jqXHR, textStatus) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This callback will be executed in any case, both for successful and unsuccesful requests.

@sonarqubecloud
Copy link

sonarqubecloud bot commented Sep 9, 2021

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 1 Code Smell

No Coverage information No Coverage information
0.0% 0.0% Duplication

@osma
Copy link
Member Author

osma commented Sep 9, 2021

I think this is good enough now - tests are missing, but handling errors like this are a bit challenging to test anyway. I'll merge this and if anything turns up it can be fixed in subsequent PRs.

@osma osma marked this pull request as ready for review September 9, 2021 14:37
@osma osma merged commit 4b4359d into master Sep 9, 2021
@osma osma deleted the fix-search-errors-waypoint-easyrdf-http branch September 9, 2021 14:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants