summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--client/src/main/java/ai/vespa/client/dsl/Rank.java2
-rw-r--r--client/src/test/java/ai/vespa/client/dsl/QTest.java10
-rw-r--r--config-model/src/main/java/com/yahoo/vespa/model/search/IndexedSearchCluster.java1
-rw-r--r--config-model/src/test/java/com/yahoo/vespa/model/content/cluster/ClusterTest.java3
-rw-r--r--configdefinitions/src/vespa/dispatch.def14
-rw-r--r--container-search/abi-spec.json3
-rw-r--r--container-search/src/main/java/com/yahoo/search/dispatch/Dispatcher.java2
-rw-r--r--container-search/src/main/java/com/yahoo/search/query/Ranking.java10
-rw-r--r--container-search/src/main/java/com/yahoo/search/query/properties/QueryProperties.java3
-rw-r--r--container-search/src/test/java/com/yahoo/search/dispatch/InterleavedSearchInvokerTest.java1
-rw-r--r--eval/src/vespa/eval/eval/basic_nodes.h4
-rw-r--r--eval/src/vespa/eval/eval/delete_node.cpp12
-rw-r--r--eval/src/vespa/eval/eval/delete_node.h6
-rw-r--r--eval/src/vespa/eval/eval/key_gen.cpp25
-rw-r--r--eval/src/vespa/eval/eval/key_gen.h7
-rw-r--r--eval/src/vespa/eval/eval/llvm/llvm_wrapper.cpp5
-rw-r--r--eval/src/vespa/eval/eval/make_tensor_function.cpp2
-rw-r--r--eval/src/vespa/eval/eval/node_tools.cpp1
-rw-r--r--eval/src/vespa/eval/eval/node_traverser.h7
-rw-r--r--eval/src/vespa/eval/eval/node_types.h6
-rw-r--r--eval/src/vespa/eval/eval/node_visitor.h6
-rw-r--r--eval/src/vespa/eval/eval/tensor_nodes.cpp8
-rw-r--r--eval/src/vespa/eval/eval/tensor_nodes.h8
-rw-r--r--eval/src/vespa/eval/eval/tensor_spec.cpp6
-rw-r--r--eval/src/vespa/eval/eval/tensor_spec.h17
-rw-r--r--eval/src/vespa/eval/eval/test/eval_spec.cpp10
-rw-r--r--eval/src/vespa/eval/eval/test/reference_evaluation.cpp2
-rw-r--r--searchcore/src/vespa/searchcore/proton/matching/matcher.cpp4
-rw-r--r--searchlib/src/tests/features/prod_features.cpp20
-rw-r--r--searchlib/src/vespa/searchlib/features/attributefeature.cpp6
-rw-r--r--searchlib/src/vespa/searchlib/features/utils.h8
-rw-r--r--searchlib/src/vespa/searchlib/fef/indexproperties.cpp8
-rw-r--r--searchlib/src/vespa/searchlib/fef/indexproperties.h1
-rw-r--r--searchlib/src/vespa/searchlib/fef/query_value.cpp18
-rw-r--r--searchlib/src/vespa/searchlib/fef/query_value.h2
-rwxr-xr-xvespaclient-java/src/main/sh/vespa-crypto-cli-standalone.sh18
-rw-r--r--vespalib/src/vespa/vespalib/locale/c.cpp2
-rw-r--r--vespalib/src/vespa/vespalib/util/string_hash.cpp19
-rw-r--r--vespalib/src/vespa/vespalib/util/string_hash.h4
39 files changed, 153 insertions, 138 deletions
diff --git a/client/src/main/java/ai/vespa/client/dsl/Rank.java b/client/src/main/java/ai/vespa/client/dsl/Rank.java
index aad70a29502..e1623aeec00 100644
--- a/client/src/main/java/ai/vespa/client/dsl/Rank.java
+++ b/client/src/main/java/ai/vespa/client/dsl/Rank.java
@@ -7,6 +7,8 @@ import java.util.Objects;
import java.util.stream.Collectors;
import java.util.stream.Stream;
+// TODO:
+// - make all items subclasses of "Query" rather than QueryChain and remove all content from QueryChain
public class Rank extends QueryChain {
private final List<QueryChain> queries = new ArrayList<>();
diff --git a/client/src/test/java/ai/vespa/client/dsl/QTest.java b/client/src/test/java/ai/vespa/client/dsl/QTest.java
index b3c26e3db6b..aae8b2c8923 100644
--- a/client/src/test/java/ai/vespa/client/dsl/QTest.java
+++ b/client/src/test/java/ai/vespa/client/dsl/QTest.java
@@ -176,6 +176,16 @@ class QTest {
}
@Test
+ void userInput_with_rank_2() {
+ String q = Q.select("doc_id")
+ .from("ss")
+ .where(Q.rank(Q.p("query").nearestNeighbor( "vector").and("doc_type").contains("pdf"),
+ Q.ui("@query"))).build();
+ assertEquals("yql=select doc_id from ss where rank(nearestNeighbor(query, vector) and doc_type contains \"pdf\", userInput(@query))",
+ q);
+ }
+
+ @Test
void dot_product() {
String q = Q.select("*")
.from("sd1")
diff --git a/config-model/src/main/java/com/yahoo/vespa/model/search/IndexedSearchCluster.java b/config-model/src/main/java/com/yahoo/vespa/model/search/IndexedSearchCluster.java
index ee221962660..c2218730d08 100644
--- a/config-model/src/main/java/com/yahoo/vespa/model/search/IndexedSearchCluster.java
+++ b/config-model/src/main/java/com/yahoo/vespa/model/search/IndexedSearchCluster.java
@@ -319,7 +319,6 @@ public class IndexedSearchCluster extends SearchCluster
if (tuning.dispatch.getMaxHitsPerPartition() != null)
builder.maxHitsPerNode(tuning.dispatch.getMaxHitsPerPartition());
- builder.searchableCopies(rootDispatch.getSearchableCopies());
builder.redundancy(rootDispatch.getRedundancy());
if (searchCoverage != null) {
if (searchCoverage.getMinimum() != null)
diff --git a/config-model/src/test/java/com/yahoo/vespa/model/content/cluster/ClusterTest.java b/config-model/src/test/java/com/yahoo/vespa/model/content/cluster/ClusterTest.java
index 1dbbe9bea9d..6b6a61823ab 100644
--- a/config-model/src/test/java/com/yahoo/vespa/model/content/cluster/ClusterTest.java
+++ b/config-model/src/test/java/com/yahoo/vespa/model/content/cluster/ClusterTest.java
@@ -61,7 +61,6 @@ public class ClusterTest {
assertEquals(11.0, config.minSearchCoverage(), DELTA);
assertEquals(0.23, config.minWaitAfterCoverageFactor(), DELTA);
assertEquals(0.58, config.maxWaitAfterCoverageFactor(), DELTA);
- assertEquals(2, config.searchableCopies());
assertEquals(3, config.redundancy());
assertEquals(DispatchConfig.DistributionPolicy.ADAPTIVE, config.distributionPolicy());
}
@@ -79,7 +78,6 @@ public class ClusterTest {
DispatchConfig.Builder builder = new DispatchConfig.Builder();
cluster.getSearch().getConfig(builder);
DispatchConfig config = new DispatchConfig(builder);
- assertEquals(2, config.searchableCopies());
assertEquals(3, config.redundancy());
assertEquals(93.0, config.minActivedocsPercentage(), DELTA);
assertEquals(DispatchConfig.DistributionPolicy.ROUNDROBIN, config.distributionPolicy());
@@ -94,7 +92,6 @@ public class ClusterTest {
DispatchConfig.Builder builder = new DispatchConfig.Builder();
cluster.getSearch().getConfig(builder);
DispatchConfig config = new DispatchConfig(builder);
- assertEquals(2, config.searchableCopies());
assertEquals(3, config.redundancy());
assertEquals(DispatchConfig.DistributionPolicy.ADAPTIVE, config.distributionPolicy());
assertEquals(1.0, config.maxWaitAfterCoverageFactor(), DELTA);
diff --git a/configdefinitions/src/vespa/dispatch.def b/configdefinitions/src/vespa/dispatch.def
index 9addfca1559..e219ea25612 100644
--- a/configdefinitions/src/vespa/dispatch.def
+++ b/configdefinitions/src/vespa/dispatch.def
@@ -26,16 +26,6 @@ maxHitsPerNode int default=2147483647
## a setting of 1.0. This is a significant optimisation with with very little loss in presicion.
topKProbability double default=0.9999
-# Is multi-level dispatch configured for this cluster
-# Deprecated, will go away soon, NOOP
-useMultilevelDispatch bool default=false
-
-# Dispatch only to local nodes. DEPRECATED: The container will automatically do this when it is appropriate.
-useLocalNode bool default=false
-
-# Number of document replicas _per group_ that will be indexed in a stable cluster.
-searchableCopies long default=1
-
# Number of document replicas _per group_ that will be present in a stable cluster.
# Should always be >= searchableCopies.
redundancy long default=1
@@ -69,7 +59,3 @@ node[].host string
# The rpc port of this search node
node[].port int
-
-# TODO(bjorncs) Remove after May 2022
-# Temporary feature flag
-mergeGroupingResultInSearchInvokerEnabled bool default=false
diff --git a/container-search/abi-spec.json b/container-search/abi-spec.json
index 17b95162709..ab8718508b7 100644
--- a/container-search/abi-spec.json
+++ b/container-search/abi-spec.json
@@ -5350,6 +5350,8 @@
"public boolean getQueryCache()",
"public void setRerankCount(int)",
"public java.lang.Integer getRerankCount()",
+ "public void setKeepRankCount(int)",
+ "public java.lang.Integer getKeepRankCount()",
"public com.yahoo.prelude.Location getLocation()",
"public void setLocation(com.yahoo.prelude.Location)",
"public void setLocation(java.lang.String)",
@@ -5384,6 +5386,7 @@
"public static final java.lang.String FRESHNESS",
"public static final java.lang.String QUERYCACHE",
"public static final java.lang.String RERANKCOUNT",
+ "public static final java.lang.String KEEPRANKCOUNT",
"public static final java.lang.String MATCH_PHASE",
"public static final java.lang.String DIVERSITY",
"public static final java.lang.String SOFTTIMEOUT",
diff --git a/container-search/src/main/java/com/yahoo/search/dispatch/Dispatcher.java b/container-search/src/main/java/com/yahoo/search/dispatch/Dispatcher.java
index 11eab6179dc..2a95908ba05 100644
--- a/container-search/src/main/java/com/yahoo/search/dispatch/Dispatcher.java
+++ b/container-search/src/main/java/com/yahoo/search/dispatch/Dispatcher.java
@@ -99,8 +99,6 @@ public class Dispatcher extends AbstractComponent {
SearchCluster searchCluster,
DispatchConfig dispatchConfig,
InvokerFactory invokerFactory) {
- if (dispatchConfig.useMultilevelDispatch())
- throw new IllegalArgumentException(searchCluster + " is configured with multilevel dispatch, but this is not supported");
this.searchCluster = searchCluster;
this.clusterMonitor = clusterMonitor;
diff --git a/container-search/src/main/java/com/yahoo/search/query/Ranking.java b/container-search/src/main/java/com/yahoo/search/query/Ranking.java
index 279ec3b0ff2..77c1d0aa621 100644
--- a/container-search/src/main/java/com/yahoo/search/query/Ranking.java
+++ b/container-search/src/main/java/com/yahoo/search/query/Ranking.java
@@ -45,6 +45,7 @@ public class Ranking implements Cloneable {
public static final String FRESHNESS = "freshness";
public static final String QUERYCACHE = "queryCache";
public static final String RERANKCOUNT = "rerankCount";
+ public static final String KEEPRANKCOUNT = "keepRankCount";
public static final String MATCH_PHASE = "matchPhase";
public static final String DIVERSITY = "diversity";
public static final String SOFTTIMEOUT = "softtimeout";
@@ -65,6 +66,7 @@ public class Ranking implements Cloneable {
argumentType.addField(new FieldDescription(FRESHNESS, "string", "datetime"));
argumentType.addField(new FieldDescription(QUERYCACHE, "boolean"));
argumentType.addField(new FieldDescription(RERANKCOUNT, "integer"));
+ argumentType.addField(new FieldDescription(KEEPRANKCOUNT, "integer"));
argumentType.addField(new FieldDescription(MATCH_PHASE, new QueryProfileFieldType(MatchPhase.getArgumentType()), "matchPhase"));
argumentType.addField(new FieldDescription(DIVERSITY, new QueryProfileFieldType(Diversity.getArgumentType())));
argumentType.addField(new FieldDescription(SOFTTIMEOUT, new QueryProfileFieldType(SoftTimeout.getArgumentType())));
@@ -95,6 +97,7 @@ public class Ranking implements Cloneable {
private boolean queryCache = false;
private Integer rerankCount = null;
+ private Integer keepRankCount = null;
private RankProperties rankProperties = new RankProperties();
@@ -161,6 +164,11 @@ public class Ranking implements Cloneable {
/** Returns the rerank-count that will be used, or null if not set */
public Integer getRerankCount() { return rerankCount; }
+ /** Sets the keep-rank-count that will be used, or null if not set */
+ public void setKeepRankCount(int keepRankCount) { this.keepRankCount = keepRankCount; }
+ /** Returns the keep-rank-count that will be used, or null if not set */
+ public Integer getKeepRankCount() { return keepRankCount; }
+
/** Returns the location of this query, or null if none */
public Location getLocation() { return location; }
@@ -235,6 +243,8 @@ public class Ranking implements Cloneable {
prepareNow(freshness);
if (rerankCount != null)
rankProperties.put("vespa.hitcollector.heapsize", rerankCount);
+ if (keepRankCount != null)
+ rankProperties.put("vespa.hitcollector.arraysize", keepRankCount);
}
private void prepareNow(Freshness freshness) {
diff --git a/container-search/src/main/java/com/yahoo/search/query/properties/QueryProperties.java b/container-search/src/main/java/com/yahoo/search/query/properties/QueryProperties.java
index 085a6382a13..d5dc8120f29 100644
--- a/container-search/src/main/java/com/yahoo/search/query/properties/QueryProperties.java
+++ b/container-search/src/main/java/com/yahoo/search/query/properties/QueryProperties.java
@@ -74,6 +74,7 @@ public class QueryProperties extends Properties {
if (key.last().equals(Ranking.FRESHNESS)) return ranking.getFreshness();
if (key.last().equals(Ranking.QUERYCACHE)) return ranking.getQueryCache();
if (key.last().equals(Ranking.RERANKCOUNT)) return ranking.getRerankCount();
+ if (key.last().equals(Ranking.KEEPRANKCOUNT)) return ranking.getKeepRankCount();
if (key.last().equals(Ranking.LIST_FEATURES)) return ranking.getListFeatures();
}
else if (key.size() >= 3 && key.get(1).equals(Ranking.MATCH_PHASE)) {
@@ -198,6 +199,8 @@ public class QueryProperties extends Properties {
ranking.setQueryCache(asBoolean(value, false));
else if (key.last().equals(Ranking.RERANKCOUNT))
ranking.setRerankCount(asInteger(value, null));
+ else if (key.last().equals(Ranking.KEEPRANKCOUNT))
+ ranking.setKeepRankCount(asInteger(value, null));
else if (key.last().equals(Ranking.LIST_FEATURES))
ranking.setListFeatures(asBoolean(value,false));
else
diff --git a/container-search/src/test/java/com/yahoo/search/dispatch/InterleavedSearchInvokerTest.java b/container-search/src/test/java/com/yahoo/search/dispatch/InterleavedSearchInvokerTest.java
index 938256b6055..7a6a64fac58 100644
--- a/container-search/src/test/java/com/yahoo/search/dispatch/InterleavedSearchInvokerTest.java
+++ b/container-search/src/test/java/com/yahoo/search/dispatch/InterleavedSearchInvokerTest.java
@@ -428,7 +428,6 @@ public class InterleavedSearchInvokerTest {
@Test
void requireCorrectCoverageCalculationWhenDegradedCoverageIsExpectedUsingTargetActiveDocs() throws IOException {
verifyCorrectCoverageCalculationWhenDegradedCoverageIsExpected(MockSearchCluster.createDispatchConfig(100.0, List.of())
- .searchableCopies(1)
.redundancy(1)
.build(),
42);
diff --git a/eval/src/vespa/eval/eval/basic_nodes.h b/eval/src/vespa/eval/eval/basic_nodes.h
index 2db00bbcb7d..b5cf36b853b 100644
--- a/eval/src/vespa/eval/eval/basic_nodes.h
+++ b/eval/src/vespa/eval/eval/basic_nodes.h
@@ -6,6 +6,7 @@
#include "string_stuff.h"
#include <vespa/vespalib/util/hdr_abort.h>
#include <vespa/vespalib/stllike/string.h>
+#include <vespa/vespalib/stllike/hash_fun.h>
#include <vespa/vespalib/util/string_hash.h>
#include <memory>
#include <map>
@@ -120,9 +121,8 @@ private:
public:
String(const vespalib::string &value_in) : _value(value_in) {}
bool is_const_double() const override { return true; }
- double get_const_double_value() const override { return hash(); }
+ double get_const_double_value() const override { return hash2d(_value); }
const vespalib::string &value() const { return _value; }
- uint32_t hash() const { return hash_code(_value.data(), _value.size()); }
vespalib::string dump(DumpContext &) const override {
return as_quoted_string(_value);
}
diff --git a/eval/src/vespa/eval/eval/delete_node.cpp b/eval/src/vespa/eval/eval/delete_node.cpp
index fb391fef5b0..f57c7f2bd68 100644
--- a/eval/src/vespa/eval/eval/delete_node.cpp
+++ b/eval/src/vespa/eval/eval/delete_node.cpp
@@ -4,15 +4,14 @@
#include "node_visitor.h"
#include "node_traverser.h"
-namespace vespalib {
-namespace eval {
+namespace vespalib::eval {
namespace {
struct ChildReaper : public NodeTraverser, public NodeHandler {
- virtual void handle(nodes::Node_UP) override {}
- virtual bool open(const nodes::Node &) override { return true; }
- virtual void close(const nodes::Node &node) override {
+ void handle(nodes::Node_UP) override {}
+ bool open(const nodes::Node &) override { return true; }
+ void close(const nodes::Node &node) override {
nodes::Node &mutable_node = const_cast<nodes::Node&>(node);
mutable_node.detach_children(*this);
}
@@ -29,5 +28,4 @@ delete_node(nodes::Node_UP node)
}
}
-} // namespace vespalib::eval
-} // namespace vespalib
+}
diff --git a/eval/src/vespa/eval/eval/delete_node.h b/eval/src/vespa/eval/eval/delete_node.h
index 376eba0653f..3049a8d6706 100644
--- a/eval/src/vespa/eval/eval/delete_node.h
+++ b/eval/src/vespa/eval/eval/delete_node.h
@@ -4,8 +4,7 @@
#include "basic_nodes.h"
-namespace vespalib {
-namespace eval {
+namespace vespalib::eval {
/**
* Function used to delete an AST with arbitrary depth without
@@ -15,5 +14,4 @@ namespace eval {
**/
void delete_node(nodes::Node_UP node);
-} // namespace vespalib::eval
-} // namespace vespalib
+}
diff --git a/eval/src/vespa/eval/eval/key_gen.cpp b/eval/src/vespa/eval/eval/key_gen.cpp
index a8f9700e865..245f872ec69 100644
--- a/eval/src/vespa/eval/eval/key_gen.cpp
+++ b/eval/src/vespa/eval/eval/key_gen.cpp
@@ -4,8 +4,7 @@
#include "node_visitor.h"
#include "node_traverser.h"
-namespace vespalib {
-namespace eval {
+namespace vespalib::eval {
using namespace nodes;
@@ -18,14 +17,23 @@ struct KeyGen : public NodeVisitor, public NodeTraverser {
void add_double(double value) { key.append(&value, sizeof(value)); }
void add_size(size_t value) { key.append(&value, sizeof(value)); }
void add_int(int value) { key.append(&value, sizeof(value)); }
- void add_hash(uint32_t value) { key.append(&value, sizeof(value)); }
void add_byte(uint8_t value) { key.append(&value, sizeof(value)); }
// visit
- void visit(const Number &node) override { add_byte( 1); add_double(node.value()); }
- void visit(const Symbol &node) override { add_byte( 2); add_int(node.id()); }
- void visit(const String &node) override { add_byte( 3); add_hash(node.hash()); }
- void visit(const In &node) override { add_byte( 4);
+ void visit(const Number &node) override {
+ add_byte( 1);
+ add_double(node.value());
+ }
+ void visit(const Symbol &node) override {
+ add_byte( 2);
+ add_int(node.id());
+ }
+ void visit(const String &node) override {
+ add_byte( 3);
+ add_double(node.get_const_double_value());
+ }
+ void visit(const In &node) override {
+ add_byte( 4);
add_size(node.num_entries());
for (size_t i = 0; i < node.num_entries(); ++i) {
add_double(node.get_entry(i).get_const_double_value());
@@ -106,5 +114,4 @@ vespalib::string gen_key(const Function &function, PassParams pass_params)
return key_gen.key;
}
-} // namespace vespalib::eval
-} // namespace vespalib
+}
diff --git a/eval/src/vespa/eval/eval/key_gen.h b/eval/src/vespa/eval/eval/key_gen.h
index c7bbf1dbd8e..868dfcf6270 100644
--- a/eval/src/vespa/eval/eval/key_gen.h
+++ b/eval/src/vespa/eval/eval/key_gen.h
@@ -4,8 +4,7 @@
#include <vespa/vespalib/stllike/string.h>
-namespace vespalib {
-namespace eval {
+namespace vespalib::eval {
class Function;
enum class PassParams : uint8_t;
@@ -16,6 +15,4 @@ enum class PassParams : uint8_t;
**/
vespalib::string gen_key(const Function &function, PassParams pass_params);
-} // namespace vespalib::eval
-} // namespace vespalib
-
+}
diff --git a/eval/src/vespa/eval/eval/llvm/llvm_wrapper.cpp b/eval/src/vespa/eval/eval/llvm/llvm_wrapper.cpp
index 158bc91dd6a..3fafb8f8b18 100644
--- a/eval/src/vespa/eval/eval/llvm/llvm_wrapper.cpp
+++ b/eval/src/vespa/eval/eval/llvm/llvm_wrapper.cpp
@@ -12,7 +12,6 @@
#include <llvm/IR/IRBuilder.h>
#include <llvm/IR/Intrinsics.h>
#include <llvm/ExecutionEngine/ExecutionEngine.h>
-#include <llvm/Analysis/Passes.h>
#include <llvm/IR/DataLayout.h>
#include <llvm/Transforms/Scalar.h>
#include <llvm/Transforms/IPO/PassManagerBuilder.h>
@@ -176,7 +175,7 @@ struct FunctionBuilder : public NodeVisitor, public NodeTraverser {
params.push_back(&(*itr));
}
}
- ~FunctionBuilder();
+ ~FunctionBuilder() override;
//-------------------------------------------------------------------------
@@ -385,7 +384,7 @@ struct FunctionBuilder : public NodeVisitor, public NodeTraverser {
push(get_param(item.id()));
}
void visit(const String &item) override {
- push_double(item.hash());
+ push_double(item.get_const_double_value());
}
void visit(const In &item) override {
llvm::Value *lhs = pop_double();
diff --git a/eval/src/vespa/eval/eval/make_tensor_function.cpp b/eval/src/vespa/eval/eval/make_tensor_function.cpp
index 1386196e719..72e8ac6cbde 100644
--- a/eval/src/vespa/eval/eval/make_tensor_function.cpp
+++ b/eval/src/vespa/eval/eval/make_tensor_function.cpp
@@ -167,7 +167,7 @@ struct TensorFunctionBuilder : public NodeVisitor, public NodeTraverser {
make_inject(node, node.id());
}
void visit(const String &node) override {
- make_const(node, stash.create<DoubleValue>(node.hash()));
+ make_const(node, stash.create<DoubleValue>(node.get_const_double_value()));
}
void visit(const In &node) override {
auto my_in = std::make_unique<In>(std::make_unique<Symbol>(0));
diff --git a/eval/src/vespa/eval/eval/node_tools.cpp b/eval/src/vespa/eval/eval/node_tools.cpp
index 477079f0d7b..a2a7847f50d 100644
--- a/eval/src/vespa/eval/eval/node_tools.cpp
+++ b/eval/src/vespa/eval/eval/node_tools.cpp
@@ -4,7 +4,6 @@
#include <vespa/eval/eval/node_traverser.h>
#include <vespa/eval/eval/node_visitor.h>
-using namespace vespalib::eval;
using namespace vespalib::eval::nodes;
namespace vespalib::eval {
diff --git a/eval/src/vespa/eval/eval/node_traverser.h b/eval/src/vespa/eval/eval/node_traverser.h
index 06c10215bc6..0143d4d58ba 100644
--- a/eval/src/vespa/eval/eval/node_traverser.h
+++ b/eval/src/vespa/eval/eval/node_traverser.h
@@ -4,8 +4,7 @@
#include "basic_nodes.h"
-namespace vespalib {
-namespace eval {
+namespace vespalib::eval {
/**
* Interface used when traversing nodes. The open function is called
@@ -23,6 +22,4 @@ struct NodeTraverser {
virtual ~NodeTraverser() {}
};
-} // namespace vespalib::eval
-} // namespace vespalib
-
+}
diff --git a/eval/src/vespa/eval/eval/node_types.h b/eval/src/vespa/eval/eval/node_types.h
index f26ddf2321b..643afd319f2 100644
--- a/eval/src/vespa/eval/eval/node_types.h
+++ b/eval/src/vespa/eval/eval/node_types.h
@@ -5,8 +5,7 @@
#include "value_type.h"
#include <map>
-namespace vespalib {
-namespace eval {
+namespace vespalib::eval {
namespace nodes { struct Node; }
class Function;
@@ -50,5 +49,4 @@ public:
}
};
-} // namespace vespalib::eval
-} // namespace vespalib
+}
diff --git a/eval/src/vespa/eval/eval/node_visitor.h b/eval/src/vespa/eval/eval/node_visitor.h
index c212612bd5f..0471ba0db68 100644
--- a/eval/src/vespa/eval/eval/node_visitor.h
+++ b/eval/src/vespa/eval/eval/node_visitor.h
@@ -7,8 +7,7 @@
#include "operator_nodes.h"
#include "call_nodes.h"
-namespace vespalib {
-namespace eval {
+namespace vespalib::eval {
/**
* Interface implemented by Node visitors to resolve the actual type
@@ -160,5 +159,4 @@ struct EmptyNodeVisitor : NodeVisitor {
void visit(const nodes::Hamming &) override {}
};
-} // namespace vespalib::eval
-} // namespace vespalib
+}
diff --git a/eval/src/vespa/eval/eval/tensor_nodes.cpp b/eval/src/vespa/eval/eval/tensor_nodes.cpp
index ae38252a72c..f78a2f99303 100644
--- a/eval/src/vespa/eval/eval/tensor_nodes.cpp
+++ b/eval/src/vespa/eval/eval/tensor_nodes.cpp
@@ -3,9 +3,7 @@
#include "tensor_nodes.h"
#include "node_visitor.h"
-namespace vespalib {
-namespace eval {
-namespace nodes {
+namespace vespalib::eval::nodes {
void TensorMap ::accept(NodeVisitor &visitor) const { visitor.visit(*this); }
void TensorJoin ::accept(NodeVisitor &visitor) const { visitor.visit(*this); }
@@ -18,6 +16,4 @@ void TensorCreate ::accept(NodeVisitor &visitor) const { visitor.visit(*this);
void TensorLambda ::accept(NodeVisitor &visitor) const { visitor.visit(*this); }
void TensorPeek ::accept(NodeVisitor &visitor) const { visitor.visit(*this); }
-} // namespace vespalib::eval::nodes
-} // namespace vespalib::eval
-} // namespace vespalib
+}
diff --git a/eval/src/vespa/eval/eval/tensor_nodes.h b/eval/src/vespa/eval/eval/tensor_nodes.h
index 2288740fab9..72840e0f610 100644
--- a/eval/src/vespa/eval/eval/tensor_nodes.h
+++ b/eval/src/vespa/eval/eval/tensor_nodes.h
@@ -12,9 +12,7 @@
#include <vector>
#include <map>
-namespace vespalib {
-namespace eval {
-namespace nodes {
+namespace vespalib::eval::nodes {
class TensorMap : public Node {
private:
@@ -414,6 +412,4 @@ public:
}
};
-} // namespace vespalib::eval::nodes
-} // namespace vespalib::eval
-} // namespace vespalib
+}
diff --git a/eval/src/vespa/eval/eval/tensor_spec.cpp b/eval/src/vespa/eval/eval/tensor_spec.cpp
index 223e32ce04f..187442941a2 100644
--- a/eval/src/vespa/eval/eval/tensor_spec.cpp
+++ b/eval/src/vespa/eval/eval/tensor_spec.cpp
@@ -14,8 +14,7 @@
#include <vespa/vespalib/data/slime/slime.h>
#include <ostream>
-namespace vespalib {
-namespace eval {
+namespace vespalib::eval {
namespace {
@@ -393,5 +392,4 @@ TensorSpec::diff(const TensorSpec &lhs, const vespalib::string &lhs_desc,
return table.to_string();
}
-} // namespace vespalib::eval
-} // namespace vespalib
+}
diff --git a/eval/src/vespa/eval/eval/tensor_spec.h b/eval/src/vespa/eval/eval/tensor_spec.h
index ef1a56cb6f0..363b8464a24 100644
--- a/eval/src/vespa/eval/eval/tensor_spec.h
+++ b/eval/src/vespa/eval/eval/tensor_spec.h
@@ -7,16 +7,12 @@
#include <memory>
#include <map>
-namespace vespalib {
+namespace vespalib::slime {
+ struct Cursor;
+ struct Inspector;
+}
-namespace slime {
-
-struct Cursor;
-struct Inspector;
-
-} // namespace vespalib::slime
-
-namespace eval {
+namespace vespalib::eval {
struct Value;
@@ -86,5 +82,4 @@ public:
bool operator==(const TensorSpec &lhs, const TensorSpec &rhs);
std::ostream &operator<<(std::ostream &out, const TensorSpec &tensor);
-} // namespace vespalib::eval
-} // namespace vespalib
+}
diff --git a/eval/src/vespa/eval/eval/test/eval_spec.cpp b/eval/src/vespa/eval/eval/test/eval_spec.cpp
index 02e9c34a75e..3bd9df18438 100644
--- a/eval/src/vespa/eval/eval/test/eval_spec.cpp
+++ b/eval/src/vespa/eval/eval/test/eval_spec.cpp
@@ -124,11 +124,11 @@ EvalSpec::add_terminal_cases() {
add_expression({}, "10").add_case({}, 10.0);
add_expression({}, "100").add_case({}, 100.0);
add_rule({"a", -5.0, 5.0}, "a", [](double a){ return a; });
- add_expression({}, "\"\"").add_case({}, vespalib::hash_code(""));
- add_expression({}, "\"foo\"").add_case({}, vespalib::hash_code("foo"));
- add_expression({}, "\"foo bar baz\"").add_case({}, vespalib::hash_code("foo bar baz"));
- add_expression({}, "\">\\\\\\\"\\t\\n\\r\\f<\"").add_case({}, vespalib::hash_code(">\\\"\t\n\r\f<"));
- add_expression({}, "\">\\x08\\x10\\x12\\x14<\"").add_case({}, vespalib::hash_code(">\x08\x10\x12\x14<"));
+ add_expression({}, "\"\"").add_case({}, vespalib::hash2d(""));
+ add_expression({}, "\"foo\"").add_case({}, vespalib::hash2d("foo"));
+ add_expression({}, "\"foo bar baz\"").add_case({}, vespalib::hash2d("foo bar baz"));
+ add_expression({}, "\">\\\\\\\"\\t\\n\\r\\f<\"").add_case({}, vespalib::hash2d(">\\\"\t\n\r\f<"));
+ add_expression({}, "\">\\x08\\x10\\x12\\x14<\"").add_case({}, vespalib::hash2d(">\x08\x10\x12\x14<"));
}
void
diff --git a/eval/src/vespa/eval/eval/test/reference_evaluation.cpp b/eval/src/vespa/eval/eval/test/reference_evaluation.cpp
index da0f5a1d1f0..acbc7463e28 100644
--- a/eval/src/vespa/eval/eval/test/reference_evaluation.cpp
+++ b/eval/src/vespa/eval/eval/test/reference_evaluation.cpp
@@ -145,7 +145,7 @@ struct EvalNode : public NodeVisitor {
eval_param(node.id());
}
void visit(const String &node) override {
- eval_const(num(node.hash()));
+ eval_const(num(node.get_const_double_value()));
}
void visit(const In &node) override {
auto my_op1 = [&](double a) {
diff --git a/searchcore/src/vespa/searchcore/proton/matching/matcher.cpp b/searchcore/src/vespa/searchcore/proton/matching/matcher.cpp
index 334948bd191..236964c2e6b 100644
--- a/searchcore/src/vespa/searchcore/proton/matching/matcher.cpp
+++ b/searchcore/src/vespa/searchcore/proton/matching/matcher.cpp
@@ -35,6 +35,7 @@ using search::fef::MatchDataLayout;
using search::fef::MatchData;
using search::fef::RankSetup;
using search::fef::indexproperties::hitcollector::HeapSize;
+using search::fef::indexproperties::hitcollector::ArraySize;
using search::queryeval::Blueprint;
using search::queryeval::SearchIterator;
using vespalib::Doom;
@@ -232,8 +233,9 @@ Matcher::match(const SearchRequest &request, vespalib::ThreadBundle &threadBundl
const Properties & rankProperties = request.propertiesMap.rankProperties();
uint32_t heapSize = HeapSize::lookup(rankProperties, _rankSetup->getHeapSize());
+ uint32_t arraySize = ArraySize::lookup(rankProperties, _rankSetup->getArraySize());
- MatchParams params(searchContext.getDocIdLimit(), heapSize, _rankSetup->getArraySize(),
+ MatchParams params(searchContext.getDocIdLimit(), heapSize, arraySize,
_rankSetup->getRankScoreDropLimit(), request.offset, request.maxhits,
!_rankSetup->getSecondPhaseRank().empty(), !willNotNeedRanking(request, groupingContext));
diff --git a/searchlib/src/tests/features/prod_features.cpp b/searchlib/src/tests/features/prod_features.cpp
index 80650050b25..73b66f36172 100644
--- a/searchlib/src/tests/features/prod_features.cpp
+++ b/searchlib/src/tests/features/prod_features.cpp
@@ -251,13 +251,13 @@ Test::testAttribute()
addScore("attribute(sebool)", 0).
addScore("attribute(sfloat)", 60.5f).
addScore("attribute(sdouble)", 67.5f).
- addScore("attribute(sstr)", (feature_t)vespalib::hash_code("foo")).
+ addScore("attribute(sstr)", vespalib::hash2d("foo")).
addScore("attribute(sint).count", 1).
addScore("attribute(sfloat).count", 1).
addScore("attribute(sstr).count", 1).
addScore("attribute(udefint)", search::attribute::getUndefined<feature_t>()).
addScore("attribute(udeffloat)", search::attribute::getUndefined<feature_t>()).
- addScore("attribute(udefstr)", (feature_t)vespalib::hash_code(""));
+ addScore("attribute(udefstr)", vespalib::hash2d(""));
FtFeatureTest ft(_factory, exp.getKeys());
ft.getIndexEnv().getBuilder()
@@ -284,8 +284,8 @@ Test::testAttribute()
addScore("attribute(aint,2)", 0).
addScore("attribute(afloat,0)", 70.5f).
addScore("attribute(afloat,1)", 80.5f).
- addScore("attribute(astr,0)", (feature_t)vespalib::hash_code("bar")).
- addScore("attribute(astr,1)", (feature_t)vespalib::hash_code("baz")).
+ addScore("attribute(astr,0)", vespalib::hash2d("bar")).
+ addScore("attribute(astr,1)", vespalib::hash2d("baz")).
addScore("attribute(aint).count", 2).
addScore("attribute(aint,0).count", 0).
addScore("attribute(afloat).count", 2).
@@ -333,10 +333,10 @@ Test::testAttribute()
addScore("attribute(wsstr,foo).value", 0).
addScore("attribute(wsstr,foo).weight", 0).
addScore("attribute(wsstr,foo).contains", 0).
- addScore("attribute(wsstr,qux).value", (feature_t)vespalib::hash_code("qux")).
+ addScore("attribute(wsstr,qux).value", vespalib::hash2d("qux")).
addScore("attribute(wsstr,qux).weight", 11).
addScore("attribute(wsstr,qux).contains", 1).
- addScore("attribute(wsstr,quux).value", (feature_t)vespalib::hash_code("quux")).
+ addScore("attribute(wsstr,quux).value", vespalib::hash2d("quux")).
addScore("attribute(wsstr,quux).weight", 12).
addScore("attribute(wsstr,quux).contains", 1).
addScore("attribute(wsint).count", 2).
@@ -1762,10 +1762,10 @@ Test::testQuery()
addScore("query(def3)", 0.0).
addScore("query(val1)", 1.1).
addScore("query(val2)", 2.2).
- addScore("query(hash1)", vespalib::hash_code("foo")).
- addScore("query(hash2)", vespalib::hash_code("2")).
- addScore("query(hash3)", vespalib::hash_code("foo")).
- addScore("query(hash4)", vespalib::hash_code("'foo"));
+ addScore("query(hash1)", vespalib::hash2d("foo")).
+ addScore("query(hash2)", vespalib::hash2d("2")).
+ addScore("query(hash3)", vespalib::hash2d("foo")).
+ addScore("query(hash4)", vespalib::hash2d("'foo"));
FtFeatureTest ft(_factory, exp.getKeys());
ft.getIndexEnv().getProperties()
.add("query(def1)", "1.0")
diff --git a/searchlib/src/vespa/searchlib/features/attributefeature.cpp b/searchlib/src/vespa/searchlib/features/attributefeature.cpp
index 8afb5ec1f21..dae1ccc994b 100644
--- a/searchlib/src/vespa/searchlib/features/attributefeature.cpp
+++ b/searchlib/src/vespa/searchlib/features/attributefeature.cpp
@@ -113,7 +113,7 @@ public:
*
* @param attribute The attribute vector to use.
*/
- SingleAttributeExecutor(const T & attribute) : _attribute(attribute) { }
+ explicit SingleAttributeExecutor(const T & attribute) : _attribute(attribute) { }
void handle_bind_outputs(vespalib::ArrayRef<fef::NumberOrObject> outputs_in) override {
fef::FeatureExecutor::handle_bind_outputs(outputs_in);
auto o = outputs().get_bound();
@@ -128,7 +128,7 @@ class BoolAttributeExecutor final : public fef::FeatureExecutor {
private:
const SingleBoolAttribute & _attribute;
public:
- BoolAttributeExecutor(const SingleBoolAttribute & attribute)
+ explicit BoolAttributeExecutor(const SingleBoolAttribute & attribute)
: _attribute(attribute)
{}
void execute(uint32_t docId) override {
@@ -162,7 +162,7 @@ private:
const attribute::IAttributeVector & _attribute;
public:
- CountOnlyAttributeExecutor(const attribute::IAttributeVector & attribute) : _attribute(attribute) { }
+ explicit CountOnlyAttributeExecutor(const attribute::IAttributeVector & attribute) : _attribute(attribute) { }
void execute(uint32_t docId) override;
void handle_bind_outputs(vespalib::ArrayRef<fef::NumberOrObject> outputs_in) override {
fef::FeatureExecutor::handle_bind_outputs(outputs_in);
diff --git a/searchlib/src/vespa/searchlib/features/utils.h b/searchlib/src/vespa/searchlib/features/utils.h
index eeecd55c6da..9a8ddacb99f 100644
--- a/searchlib/src/vespa/searchlib/features/utils.h
+++ b/searchlib/src/vespa/searchlib/features/utils.h
@@ -57,7 +57,7 @@ inline feature_t getAsFeature(T value)
*/
template <>
inline feature_t getAsFeature<ConstCharPtr>(ConstCharPtr value) {
- return static_cast<feature_t>(vespalib::hash_code(value, strlen(value)));
+ return vespalib::hash2d(value, strlen(value));
}
/**
@@ -68,7 +68,7 @@ inline feature_t getAsFeature<ConstCharPtr>(ConstCharPtr value) {
*/
template <>
inline feature_t getAsFeature<vespalib::stringref>(vespalib::stringref value) {
- return static_cast<feature_t>(vespalib::hash_code(value));
+ return vespalib::hash2d(value);
}
@@ -184,7 +184,7 @@ lookupTable(const search::fef::IIndexEnvironment & env, const vespalib::string &
inline const search::fef::ITermFieldData *
getTermFieldData(const search::fef::IQueryEnvironment &env, uint32_t termId, uint32_t fieldId) {
const search::fef::ITermData *td = env.getTerm(termId);
- return (td == 0) ? 0 : td->lookupField(fieldId);
+ return (td == nullptr) ? nullptr : td->lookupField(fieldId);
}
/**
@@ -198,7 +198,7 @@ getTermFieldData(const search::fef::IQueryEnvironment &env, uint32_t termId, uin
inline search::fef::TermFieldHandle
getTermFieldHandle(const search::fef::IQueryEnvironment &env, uint32_t termId, uint32_t fieldId) {
const search::fef::ITermFieldData *tfd = getTermFieldData(env, termId, fieldId);
- return (tfd == 0) ? search::fef::IllegalHandle : tfd->getHandle();
+ return (tfd == nullptr) ? search::fef::IllegalHandle : tfd->getHandle();
}
/**
diff --git a/searchlib/src/vespa/searchlib/fef/indexproperties.cpp b/searchlib/src/vespa/searchlib/fef/indexproperties.cpp
index 70433800469..26a7be005b7 100644
--- a/searchlib/src/vespa/searchlib/fef/indexproperties.cpp
+++ b/searchlib/src/vespa/searchlib/fef/indexproperties.cpp
@@ -587,7 +587,13 @@ const uint32_t ArraySize::DEFAULT_VALUE(10000);
uint32_t
ArraySize::lookup(const Properties &props)
{
- return lookupUint32(props, NAME, DEFAULT_VALUE);
+ return lookup(props, DEFAULT_VALUE);
+}
+
+uint32_t
+ArraySize::lookup(const Properties &props, uint32_t defaultValue)
+{
+ return lookupUint32(props, NAME, defaultValue);
}
const vespalib::string EstimatePoint::NAME("vespa.hitcollector.estimatepoint");
diff --git a/searchlib/src/vespa/searchlib/fef/indexproperties.h b/searchlib/src/vespa/searchlib/fef/indexproperties.h
index 3ebfe781400..5ff4ea26bd8 100644
--- a/searchlib/src/vespa/searchlib/fef/indexproperties.h
+++ b/searchlib/src/vespa/searchlib/fef/indexproperties.h
@@ -476,6 +476,7 @@ namespace hitcollector {
static const vespalib::string NAME;
static const uint32_t DEFAULT_VALUE;
static uint32_t lookup(const Properties &props);
+ static uint32_t lookup(const Properties &props, uint32_t defaultValue);
};
/**
diff --git a/searchlib/src/vespa/searchlib/fef/query_value.cpp b/searchlib/src/vespa/searchlib/fef/query_value.cpp
index 8b881bc722f..ea17743bfc7 100644
--- a/searchlib/src/vespa/searchlib/fef/query_value.cpp
+++ b/searchlib/src/vespa/searchlib/fef/query_value.cpp
@@ -4,6 +4,7 @@
#include "iindexenvironment.h"
#include "indexproperties.h"
#include "iqueryenvironment.h"
+#include <vespa/searchlib/features/utils.h>
#include <vespa/document/datatype/tensor_data_type.h>
#include <vespa/eval/eval/fast_value.h>
#include <vespa/eval/eval/interpreted_function.h>
@@ -11,7 +12,6 @@
#include <vespa/eval/eval/value_codec.h>
#include <vespa/vespalib/locale/c.h>
#include <vespa/vespalib/util/issue.h>
-#include <vespa/vespalib/util/string_hash.h>
#include <cerrno>
using document::TensorDataType;
@@ -59,10 +59,10 @@ as_feature(const vespalib::string& str)
errno = 0;
double val = vespalib::locale::c::strtod(str.c_str(), &end);
if (errno != 0 || *end != '\0') { // not happy
- if (str.size() > 0 && str[0] == '\'') {
- val = vespalib::hash_code(str.substr(1));
+ if ( ! str.empty() && str[0] == '\'') {
+ val = features::util::getAsFeature(vespalib::stringref(str.substr(1)));
} else {
- val = vespalib::hash_code(str);
+ val = features::util::getAsFeature(vespalib::stringref(str));
}
}
return val;
@@ -84,7 +84,7 @@ as_tensor(const vespalib::string& expr, const ValueType& wanted_type)
auto fun = Function::parse(expr);
if (!fun->has_error() && (fun->num_params() == 0)) {
NodeTypes types = NodeTypes(*fun, {});
- ValueType res_type = types.get_type(fun->root());
+ const ValueType & res_type = types.get_type(fun->root());
if (res_type == wanted_type) {
SimpleObjectParams params({});
InterpretedFunction ifun(factory, *fun, types);
@@ -152,12 +152,12 @@ QueryValue::QueryValue()
{
}
-QueryValue::QueryValue(const vespalib::string& key, const vespalib::eval::ValueType& type)
+QueryValue::QueryValue(const vespalib::string& key, vespalib::eval::ValueType type)
: _key(key),
_name("query(" + key + ")"),
_old_key("$" + key),
_stored_value_key("query.value." + key),
- _type(type)
+ _type(std::move(type))
{
}
@@ -171,7 +171,7 @@ QueryValue::from_config(const vespalib::string& key, const IIndexEnvironment& en
if (type.is_error()) {
throw InvalidValueTypeException(key, type_str);
}
- return {key, type};
+ return {key, std::move(type)};
}
std::unique_ptr<Value>
@@ -187,7 +187,7 @@ QueryValue::make_default_value(const IIndexEnvironment& env) const
} else {
if (p.found()) {
auto tensor = as_tensor(p.get(), _type);
- if (tensor.get() == nullptr) {
+ if ( ! tensor) {
throw InvalidTensorValueException(_type, p.get().c_str());
}
return tensor;
diff --git a/searchlib/src/vespa/searchlib/fef/query_value.h b/searchlib/src/vespa/searchlib/fef/query_value.h
index fb014883268..17042d662c3 100644
--- a/searchlib/src/vespa/searchlib/fef/query_value.h
+++ b/searchlib/src/vespa/searchlib/fef/query_value.h
@@ -59,7 +59,7 @@ private:
public:
QueryValue();
- QueryValue(const vespalib::string& key, const vespalib::eval::ValueType& type);
+ QueryValue(const vespalib::string& key, vespalib::eval::ValueType type);
~QueryValue();
/**
diff --git a/vespaclient-java/src/main/sh/vespa-crypto-cli-standalone.sh b/vespaclient-java/src/main/sh/vespa-crypto-cli-standalone.sh
new file mode 100755
index 00000000000..15c71c6938b
--- /dev/null
+++ b/vespaclient-java/src/main/sh/vespa-crypto-cli-standalone.sh
@@ -0,0 +1,18 @@
+#!/usr/bin/env sh
+# Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+
+# Resolve symlink (if any) and normalize path
+program=$(readlink -f "$0")
+program_dir=$(dirname "$program")
+jarfile=$(readlink -f "$program_dir"/../../../target/vespaclient-java-jar-with-dependencies.jar)
+
+if ! test -e "$jarfile"
+then
+ echo "No such file: '$jarfile'" >&2
+ exit 1
+fi
+
+exec java \
+-Djava.awt.headless=true \
+-Xms128m -Xmx2048m \
+-cp "$jarfile" com.yahoo.vespa.security.tool.Main "$@"
diff --git a/vespalib/src/vespa/vespalib/locale/c.cpp b/vespalib/src/vespa/vespalib/locale/c.cpp
index f6d71857d5a..ffc29b2e104 100644
--- a/vespalib/src/vespa/vespalib/locale/c.cpp
+++ b/vespalib/src/vespa/vespalib/locale/c.cpp
@@ -3,7 +3,7 @@
#include "c.h"
#include "locale.h"
#include <cstdlib>
-#include <errno.h>
+#include <cerrno>
namespace vespalib::locale::c {
diff --git a/vespalib/src/vespa/vespalib/util/string_hash.cpp b/vespalib/src/vespa/vespalib/util/string_hash.cpp
index 572ba765743..de0865fe86f 100644
--- a/vespalib/src/vespa/vespalib/util/string_hash.cpp
+++ b/vespalib/src/vespa/vespalib/util/string_hash.cpp
@@ -1,19 +1,24 @@
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include "string_hash.h"
+#include <vespa/vespalib/stllike/hash_fun.h>
namespace vespalib {
-uint32_t hash_code(const char *str, size_t len) {
- uint32_t hash = 0;
- for (size_t i = 0; i < len; ++i) {
- hash = (hash << 5) - hash + str[i];
+double hash2d(const char *str, size_t len) {
+ size_t h = hashValue(str, len);
+ if ((h & 0x7ff0000000000000ul) == 0x7ff0000000000000ul) {
+ // Avoid nan
+ h = h & 0xffeffffffffffffful;
}
- return hash;
+ double d = 0;
+ static_assert(sizeof(d) == sizeof(h));
+ memcpy(&d, &h, sizeof(d));
+ return d;
}
-uint32_t hash_code(vespalib::stringref str) {
- return hash_code(str.data(), str.size());
+double hash2d(vespalib::stringref str) {
+ return hash2d(str.data(), str.size());
}
} // namespace vespalib
diff --git a/vespalib/src/vespa/vespalib/util/string_hash.h b/vespalib/src/vespa/vespalib/util/string_hash.h
index 14a5a85a009..495a8378b42 100644
--- a/vespalib/src/vespa/vespalib/util/string_hash.h
+++ b/vespalib/src/vespa/vespalib/util/string_hash.h
@@ -9,8 +9,8 @@ namespace vespalib {
/**
* simple string hashing function similar to the one used by Java.
**/
-uint32_t hash_code(const char *str, size_t len);
-uint32_t hash_code(vespalib::stringref str);
+double hash2d(const char *str, size_t len);
+double hash2d(vespalib::stringref str);
} // namespace vespalib