summaryrefslogtreecommitdiff
path: root/modules/search/helpers
diff options
context:
space:
mode:
authorBharat Mediratta <bharat@menalto.com>2012-12-09 20:26:16 -0800
committerBharat Mediratta <bharat@menalto.com>2012-12-09 20:26:16 -0800
commita74e3aea6f0bdde210c91622535af3e58aa1e9fd (patch)
tree7d2b5d1ad10cbbbdb7d7c0fc4ae6816eef6dff8e /modules/search/helpers
parentf457cd283cdfd9011d76ae96872e1f08bb219baf (diff)
Eliminate the search context if we encounter an item that cannot be
found in the search results. Fixes #1923.
Diffstat (limited to 'modules/search/helpers')
-rw-r--r--modules/search/helpers/search.php9
1 files changed, 8 insertions, 1 deletions
diff --git a/modules/search/helpers/search.php b/modules/search/helpers/search.php
index b7fa21c4..64a13825 100644
--- a/modules/search/helpers/search.php
+++ b/modules/search/helpers/search.php
@@ -117,7 +117,14 @@ class search_Core {
// Truncate the score by two decimal places as this resolves the issues
// that arise due to in exact numeric conversions.
- $score = $db->query($query)->current()->score;
+ $current = $db->query($query)->current();
+ if (!$current) {
+ // We can't find this result in our result set - perhaps we've fallen out of context? Clear
+ // the context and try again.
+ item::clear_display_context_callback();
+ url::redirect(url::current());
+ }
+ $score = $current->score();
if (strlen($score) > 7) {
$score = substr($score, 0, strlen($score) - 2);
}