8000 Feature/search 213 optimize levenshtein startswith by Dronplane · Pull Request #14744 · arangodb/arangodb · GitHub
[go: up one dir, main page]

Skip to content

Feature/search 213 optimize levenshtein startswith #14744

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 29 commits into from
Sep 10, 2021
Merged
Changes from 1 commit
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
64944e5
group conjunction nodes
Dronplane Sep 3, 2021
c6d0ab3
Merge branch 'devel' into feature/SEARCH-213-Optimize-Levenshtein-sta…
Dronplane Sep 6, 2021
4664cc4
wip
Dronplane Sep 6, 2021
b545d56
tests
Dronplane Sep 6, 2021
b026fa4
tests
Dronplane Sep 7, 2021
9dfe7b9
tests
Dronplane Sep 7, 2021
0abc986
Merge branch 'devel' into feature/SEARCH-213-Optimize-Levenshtein-sta…
Dronplane Sep 7, 2021
5b8eda2
moar tests
Dronplane Sep 7, 2021
6f11b5d
add option to explicitly block merging
Dronplane Sep 7, 2021
337cd90
moar corner cases
Dronplane Sep 8, 2021
17ea36a
empty case optimization
Dronplane Sep 8, 2021
55c038c
optimization
Dronplane Sep 8, 2021
229c972
cleanup
Dronplane Sep 8, 2021
f5d8684
fix startsWith boost
Dronplane Sep 8, 2021
af37ee0
cleanup
Dronplane Sep 8, 2021
eae7ebb
wip
Dronplane Sep 8, 2021
26386d4
wip
Dronplane Sep 8, 2021
37be60d
comments
Dronplane Sep 8, 2021
bcd2093
add node serialization tests
Dronplane Sep 8, 2021
d649660
Update arangod/IResearch/IResearchFilterFactory.cpp
Dronplane Sep 9, 2021
4cd8331
adress review comments
Dronplane Sep 9, 2021
a969139
address review comments
Dronplane Sep 9, 2021
0e6b6cf
add js test
Dronplane Sep 9, 2021
0c6d9ca
adress review comments
Dronplane Sep 9, 2021
09c678c
Update CHANGELOG
Dronplane Sep 9, 2021
1708a0a
Merge branch 'devel' into feature/SEARCH-213-Optimize-Levenshtein-sta…
Dronplane Sep 9, 2021
d234738
Merge branch 'devel' into feature/SEARCH-213-Optimize-Levenshtein-sta…
Dronplane Sep 10, 2021
f89293e
None -> NONE renaming
Dronplane Sep 10, 2021
340087d
Merge branch 'feature/SEARCH-213-Optimize-Levenshtein-startswith' of …
Dronplane Sep 10, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
add node serialization tests
  • Loading branch information
Dronplane committed Sep 8, 2021
commit bcd20935e4bae60f4e714abb9ec1f1e1c794c1a6
106 changes: 105 additions & 1 deletion tests/IResearch/IResearchViewNode-test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2172,6 +2172,7 @@ TEST_F(IResearchViewNodeTest, serialize) {
EXPECT_EQ(node.sort(), deserialized.sort());
EXPECT_EQ(node.getCost(), deserialized.getCost());
EXPECT_EQ(node.options().countApproximate, arangodb::iresearch::CountApproximate::Exact);
EXPECT_EQ(node.options().allowFiltersMerge, true);
}

// factory method
Expand All @@ -2197,6 +2198,7 @@ TEST_F(IResearchViewNodeTest, serialize) {
EXPECT_EQ(node.sort(), deserialized.sort());
EXPECT_EQ(node.getCost(), deserialized.getCost());
EXPECT_EQ(node.options().countApproximate, arangodb::iresearch::CountApproximate::Exact);
EXPECT_EQ(node.options().allowFiltersMerge, true);
}
}

Expand Down Expand Up @@ -2256,6 +2258,7 @@ TEST_F(IResearchViewNodeTest, serialize) {
EXPECT_EQ(node.sort(), deserialized.sort());
EXPECT_EQ(node.getCost(), deserialized.getCost());
EXPECT_EQ(node.options().countApproximate, arangodb::iresearch::CountApproximate::Exact);
EXPECT_EQ(node.options().allowFiltersMerge, true);
}

// factory method
Expand All @@ -2281,6 +2284,7 @@ TEST_F(IResearchViewNodeTest, serialize) {
EXPECT_EQ(node.sort(), deserialized.sort());
EXPECT_EQ(node.getCost(), deserialized.getCost());
EXPECT_EQ(node.options().countApproximate, arangodb::iresearch::CountApproximate::Exact);
EXPECT_EQ(node.options().allowFiltersMerge, true);
}
}
// with late materialization
Expand Down Expand Up @@ -2335,6 +2339,7 @@ TEST_F(IResearchViewNodeTest, serialize) {
EXPECT_EQ(outNmDocId.id, varsSetHere[1]->id);
EXPECT_EQ(outNmDocId.name, varsSetHere[1]->name);
EXPECT_EQ(node.options().countApproximate, arangodb::iresearch::CountApproximate::Exact);
EXPECT_EQ(node.options().allowFiltersMerge, true);
}

// factory method
Expand Down Expand Up @@ -2367,6 +2372,7 @@ TEST_F(IResearchViewNodeTest, serialize) {
EXPECT_EQ(outNmDocId.id, varsSetHere[1]->id);
EXPECT_EQ(outNmDocId.name, varsSetHere[1]->name);
EXPECT_EQ(node.options().countApproximate, arangodb::iresearch::CountApproximate::Exact);
EXPECT_EQ(node.options().allowFiltersMerge, true);
}
}
// with countApproximate cost
Expand Down Expand Up @@ -2419,7 +2425,7 @@ TEST_F(IResearchViewNodeTest, serialize) {
EXPECT_EQ(deserialized.options().countApproximate, arangodb::iresearch::CountApproximate::Cost);
}
}
// with countApproximate exact
// with countApproximate exact
{
std::string value{ "exact" };
arangodb::aql::AstNode attributeValue(arangodb::aql::NODE_TYPE_VALUE);
Expand Down Expand Up @@ -2469,6 +2475,104 @@ TEST_F(IResearchViewNodeTest, serialize) {
EXPECT_EQ(deserialized.options().countApproximate, arangodb::iresearch::CountApproximate::Exact);
}
}
// with allowed merge filters
{
arangodb::aql::AstNode attributeValue(arangodb::aql::NODE_TYPE_VALUE);
attributeValue.setValueType(arangodb::aql::VALUE_TYPE_BOOL);
attributeValue.setBoolValue(true);
arangodb::aql::AstNode attributeName(arangodb::aql::NODE_TYPE_OBJECT_ELEMENT);
attributeName.addMember(&attributeValue);
std::string name{ "allowFiltersMerge" };
attributeName.setStringValue(name.c_str(), name.size());
arangodb::aql::AstNode options(arangodb::aql::NODE_TYPE_OBJECT);
options.addMember(&attributeName);

arangodb::iresearch::IResearchViewNode node(*query.plan(),
arangodb::aql::ExecutionNodeId{42},
vocbase, // database
logicalView, // view
outVariable,
nullptr, // no filter condition
&options, // no options
{}); // no sort condition


node.setVarsUsedLater({arangodb::aql::VarSet{&outVariable}});
node.setVarsValid({{}});
node.setRegsToKeep({{}});
node.setVarUsageValid();

arangodb::velocypack::Builder builder;
unsigned flags = arangodb::aql::ExecutionNode::SERIALIZE_DETAILS;
node.toVelocyPack(builder, flags); // object with array of objects

auto nodeSlice = builder.slice();

// constructor
{
arangodb::iresearch::IResearchViewNode const deserialized(*query.plan(), nodeSlice);
EXPECT_EQ(node.empty(), deserialized.empty());
EXPECT_EQ(deserialized.options().allowFiltersMerge, true);
}

// factory method
{
std::unique_ptr<arangodb::aql::ExecutionNode> deserializedNode(
arangodb::aql::ExecutionNode::fromVPackFactory(query.plan(), nodeSlice));
auto& deserialized =
dynamic_cast<arangodb::iresearch::IResearchViewNode&>(*deserializedNode);
EXPECT_EQ(deserialized.options().allowFiltersMerge, true);
}
}
// with forbidden merge filters
{
arangodb::aql::AstNode attributeValue(arangodb::aql::NODE_TYPE_VALUE);
attributeValue.setValueType(arangodb::aql::VALUE_TYPE_BOOL);
attributeValue.setBoolValue(false);
arangodb::aql::AstNode attributeName(arangodb::aql::NODE_TYPE_OBJECT_ELEMENT);
attributeName.addMember(&attributeValue);
std::string name{ "allowFiltersMerge" };
attributeName.setStringValue(name.c_str(), name.size());
arangodb::aql::AstNode options(arangodb::aql::NODE_TYPE_OBJECT);
options.addMember(&attributeName);

arangodb::iresearch::IResearchViewNode node(*query.plan(),
arangodb::aql::ExecutionNodeId{42},
vocbase, // database
logicalView, // view
outVariable,
nullptr, // no filter condition
&options, // no options
{}); // no sort condition


node.setVarsUsedLater({arangodb::aql::VarSet{&outVariable}});
node.setVarsValid({{}});
node.setRegsToKeep({{}});
node.setVarUsageValid();

arangodb::velocypack::Builder builder;
unsigned flags = arangodb::aql::ExecutionNode::SERIALIZE_DETAILS;
node.toVelocyPack(builder, flags); // object with array of objects

auto nodeSlice = builder.slice();

// constructor
{
arangodb::iresearch::IResearchViewNode const deserialized(*query.plan(), nodeSlice);
EXPECT_EQ(node.empty(), deserialized.empty());
EXPECT_EQ(deserialized.options().allowFiltersMerge, false);
}

// factory method
{
std::unique_ptr<arangodb::aql::ExecutionNode> deserializedNode(
arangodb::aql::ExecutionNode::fromVPackFactory(query.plan(), nodeSlice));
auto& deserialized =
dynamic_cast<arangodb::iresearch::IResearchViewNode&>(*deserializedNode);
EXPECT_EQ(deserialized.options().allowFiltersMerge, false);
}
}
}

TEST_F(IResearchViewNodeTest, serializeSortedView) {
Expand Down
0