Handle empty search result set #1076
Merged
Conversation
This PR doesn't differ from master and the deployment on Heroku is running just fine... |
there was a crash again for about an hour last night too, around 8:30pm |
@vanessayuenn tracked down a probable cause:
|
This is a query that kills it:
|
This patch should handle that error, it looks like we handle missing results for the diff --git a/routes/search/index.js b/routes/search/index.js
index 46ab389c..9b615c39 100644
--- a/routes/search/index.js
+++ b/routes/search/index.js
@@ -32,7 +32,7 @@ module.exports = (req, res) => {
return {
searchOp,
// FIXME: use real pagination
- resultsNum: results.data[searchOp.name].length,
+ resultsNum: results.data[searchOp.name] ? results.data[searchOp.name].length : 0,
results: (req.params.searchIn || req.query.json !== undefined)
? results.data[searchOp.name] : results.data[searchOp.name].slice(0, 5)
} |
Thanks for sleuthing, @codebytere, @vanessayuenn, and @MarshallOfSound. I've committed a fix here. |
I could still reproduce crash with the same query |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
The website went down for a bit today. To fix it, I rolled back to a previous version on Heroku.
This is an exploratory PR to help diagnose if something is wrong with the
master
branch.