aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/plugins
diff options
context:
space:
mode:
authorRobin Houston <robin.houston@gmail.com>2012-01-19 13:50:26 +0000
committerRobin Houston <robin.houston@gmail.com>2012-01-19 13:50:26 +0000
commit22b2db48c005be1d1b87dd6b58f830a2a74d2108 (patch)
tree2355e7d73515b38ecd0edf1616498f4e62b82cd4 /vendor/plugins
parent69a2ea41c7c723ba11690ee6ed148cda012f8358 (diff)
Limit Xapian wildcard expansions
Wildcard searches in Xapian can expand uncontrollably, consuming all available RAM and crashing the server. This has been a real problem on WhatDoTheyKnow.com. The underlying issue is tracked in http://trac.xapian.org/ticket/350 This changeset imposes a limit on wildcard expansion. The type-ahead search will first try a wildcard query, and if that fails because of too much expansion will fall back to a plain non-wildcard search.
Diffstat (limited to 'vendor/plugins')
-rw-r--r--vendor/plugins/acts_as_xapian/lib/acts_as_xapian.rb1
1 files changed, 1 insertions, 0 deletions
diff --git a/vendor/plugins/acts_as_xapian/lib/acts_as_xapian.rb b/vendor/plugins/acts_as_xapian/lib/acts_as_xapian.rb
index 38bfb7c98..dd033a112 100644
--- a/vendor/plugins/acts_as_xapian/lib/acts_as_xapian.rb
+++ b/vendor/plugins/acts_as_xapian/lib/acts_as_xapian.rb
@@ -143,6 +143,7 @@ module ActsAsXapian
@@query_parser.stemming_strategy = Xapian::QueryParser::STEM_SOME
@@query_parser.database = @@db
@@query_parser.default_op = Xapian::Query::OP_AND
+ @@query_parser.set_max_wildcard_expansion(1000)
@@stopper = Xapian::SimpleStopper.new
@@stopper.add("and")