aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2017-06-14 12:06:57 +0200
committerHenning Baldersheim <balder@yahoo-inc.com>2017-06-14 12:06:57 +0200
commit0125c7ddd3069f8130d8585de28903e75156c568 (patch)
tree12a755799aa7660129fdfda325f9f642648eaa66
parentf400647e7aa0696dc847f765872dc318f01de559 (diff)
If more than 1k unique values we will just approximate.
-rw-r--r--searchlib/src/vespa/searchlib/attribute/enumstorebase.h2
-rw-r--r--searchlib/src/vespa/searchlib/attribute/postinglistsearchcontext.hpp10
2 files changed, 5 insertions, 7 deletions
diff --git a/searchlib/src/vespa/searchlib/attribute/enumstorebase.h b/searchlib/src/vespa/searchlib/attribute/enumstorebase.h
index 2960d573098..fe96928dccd 100644
--- a/searchlib/src/vespa/searchlib/attribute/enumstorebase.h
+++ b/searchlib/src/vespa/searchlib/attribute/enumstorebase.h
@@ -7,8 +7,8 @@
#include <vespa/searchlib/datastore/datastore.h>
#include <vespa/searchlib/util/memoryusage.h>
#include <vespa/vespalib/util/array.h>
-#include <set>
#include <vespa/searchlib/btree/btree.h>
+#include <set>
#include <atomic>
namespace vespalib { class asciistream; }
diff --git a/searchlib/src/vespa/searchlib/attribute/postinglistsearchcontext.hpp b/searchlib/src/vespa/searchlib/attribute/postinglistsearchcontext.hpp
index 918a8a0f0b3..573af5f40bd 100644
--- a/searchlib/src/vespa/searchlib/attribute/postinglistsearchcontext.hpp
+++ b/searchlib/src/vespa/searchlib/attribute/postinglistsearchcontext.hpp
@@ -296,12 +296,10 @@ PostingListSearchContextT<DataT>::approximateHits() const
if (this->fallbackToFiltering()) {
numHits = _docIdLimit;
} else if (_uniqueValues > MIN_UNIQUE_VALUES_BEFORE_APPROXIMATION) {
- if ((_uniqueValues *
- MIN_UNIQUE_VALUES_TO_NUMDOCS_RATIO_BEFORE_APPROXIMATION >
- static_cast<int>(_docIdLimit)) ||
- (this->calculateApproxNumHits() *
- MIN_APPROXHITS_TO_NUMDOCS_RATIO_BEFORE_APPROXIMATION >
- _docIdLimit)) {
+ if ((_uniqueValues * MIN_UNIQUE_VALUES_TO_NUMDOCS_RATIO_BEFORE_APPROXIMATION > static_cast<int>(_docIdLimit)) ||
+ (this->calculateApproxNumHits() * MIN_APPROXHITS_TO_NUMDOCS_RATIO_BEFORE_APPROXIMATION > _docIdLimit) ||
+ (_uniqueValues > MIN_UNIQUE_VALUES_BEFORE_APPROXIMATION*10))
+ {
numHits = this->calculateApproxNumHits();
} else {
// XXX: Unsafe