summaryrefslogtreecommitdiffstats
path: root/searchlib
diff options
context:
space:
mode:
authorTor Egge <Tor.Egge@broadpark.no>2020-06-23 15:48:20 +0200
committerTor Egge <Tor.Egge@broadpark.no>2020-06-23 17:19:35 +0200
commit1885eff6b6ab74e8a2ce402fc849a7e31ef50fbf (patch)
treec77c0365aeb4169461a5410bf03efbd2916896dd /searchlib
parent7a7279d2980cd4099b8070cbf0c298dc8d666301 (diff)
If the estimated rate of matching documents is less than global filter limit then
don't build a global filter.
Diffstat (limited to 'searchlib')
-rw-r--r--searchlib/src/vespa/searchlib/fef/indexproperties.cpp16
-rw-r--r--searchlib/src/vespa/searchlib/fef/indexproperties.h13
-rw-r--r--searchlib/src/vespa/searchlib/fef/ranksetup.cpp4
-rw-r--r--searchlib/src/vespa/searchlib/fef/ranksetup.h4
4 files changed, 36 insertions, 1 deletions
diff --git a/searchlib/src/vespa/searchlib/fef/indexproperties.cpp b/searchlib/src/vespa/searchlib/fef/indexproperties.cpp
index fb44b986301..622e437692a 100644
--- a/searchlib/src/vespa/searchlib/fef/indexproperties.cpp
+++ b/searchlib/src/vespa/searchlib/fef/indexproperties.cpp
@@ -290,6 +290,22 @@ NearestNeighborBruteForceLimit::lookup(const Properties &props, double defaultVa
return lookupDouble(props, NAME, defaultValue);
}
+const vespalib::string GlobalFilterLimit::NAME("vespa.matching.global_filter_limit");
+
+const double GlobalFilterLimit::DEFAULT_VALUE(0.0);
+
+double
+GlobalFilterLimit::lookup(const Properties &props)
+{
+ return lookup(props, DEFAULT_VALUE);
+}
+
+double
+GlobalFilterLimit::lookup(const Properties &props, double defaultValue)
+{
+ return lookupDouble(props, NAME, defaultValue);
+}
+
} // namespace matching
namespace softtimeout {
diff --git a/searchlib/src/vespa/searchlib/fef/indexproperties.h b/searchlib/src/vespa/searchlib/fef/indexproperties.h
index 30c726caeba..1b4c2e92d8d 100644
--- a/searchlib/src/vespa/searchlib/fef/indexproperties.h
+++ b/searchlib/src/vespa/searchlib/fef/indexproperties.h
@@ -218,6 +218,19 @@ namespace matching {
static double lookup(const Properties &props);
static double lookup(const Properties &props, double defaultValue);
};
+
+ /**
+ * Property to control fallback to not building a global filter
+ * for a query with a blueprint that wants a global filter. If the
+ * estimated ratio of matching documents is less than this limit
+ * then don't build a global filter.
+ **/
+ struct GlobalFilterLimit {
+ static const vespalib::string NAME;
+ static const double DEFAULT_VALUE;
+ static double lookup(const Properties &props);
+ static double lookup(const Properties &props, double defaultValue);
+ };
}
namespace softtimeout {
diff --git a/searchlib/src/vespa/searchlib/fef/ranksetup.cpp b/searchlib/src/vespa/searchlib/fef/ranksetup.cpp
index e197f095852..249351a4fe5 100644
--- a/searchlib/src/vespa/searchlib/fef/ranksetup.cpp
+++ b/searchlib/src/vespa/searchlib/fef/ranksetup.cpp
@@ -62,7 +62,8 @@ RankSetup::RankSetup(const BlueprintFactory &factory, const IIndexEnvironment &i
_softTimeoutEnabled(false),
_softTimeoutTailCost(0.1),
_softTimeoutFactor(0.5),
- _nearest_neighbor_brute_force_limit(0.05)
+ _nearest_neighbor_brute_force_limit(0.05),
+ _global_filter_limit(0.0)
{ }
RankSetup::~RankSetup() = default;
@@ -106,6 +107,7 @@ RankSetup::configure()
setSoftTimeoutTailCost(softtimeout::TailCost::lookup(_indexEnv.getProperties()));
setSoftTimeoutFactor(softtimeout::Factor::lookup(_indexEnv.getProperties()));
set_nearest_neighbor_brute_force_limit(matching::NearestNeighborBruteForceLimit::lookup(_indexEnv.getProperties()));
+ set_global_filter_limit(matching::GlobalFilterLimit::lookup(_indexEnv.getProperties()));
}
void
diff --git a/searchlib/src/vespa/searchlib/fef/ranksetup.h b/searchlib/src/vespa/searchlib/fef/ranksetup.h
index ad793eeaceb..3e127a1e8b5 100644
--- a/searchlib/src/vespa/searchlib/fef/ranksetup.h
+++ b/searchlib/src/vespa/searchlib/fef/ranksetup.h
@@ -60,6 +60,7 @@ private:
double _softTimeoutTailCost;
double _softTimeoutFactor;
double _nearest_neighbor_brute_force_limit;
+ double _global_filter_limit;
public:
@@ -369,6 +370,9 @@ public:
void set_nearest_neighbor_brute_force_limit(double v) { _nearest_neighbor_brute_force_limit = v; }
double get_nearest_neighbor_brute_force_limit() const { return _nearest_neighbor_brute_force_limit; }
+ void set_global_filter_limit(double v) { _global_filter_limit = v; }
+ double get_global_filter_limit() const { return _global_filter_limit; }
+
/**
* This method may be used to indicate that certain features
* should be dumped during a full feature dump.