8000 Fixed BTS-408 by jsteemann · Pull Request #14513 · arangodb/arangodb · GitHub
[go: up one dir, main page]

Skip to content

Fixed BTS-408 #14513

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 5 commits into from
Jul 19, 2021
Merged
Changes from 1 commit
Commits
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
deduplicate code
  • Loading branch information
jsteemann committed Jul 19, 2021
commit 6b51c70daba1f38da038569a6cd8edefa46da0f5
47 changes: 9 additions & 38 deletions arangod/IResearch/IResearchFilterFactory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -891,44 +891,6 @@ Result byRange(irs::boolean_filter* filter,
return byRange<Min>(filter, name, value, incl, ctx, filterCtx);
}

Result fromExpression(irs::boolean_filter* filter, QueryContext const& ctx,
FilterContext const& filterCtx,
std::shared_ptr<aql::AstNode>&& node) {
if (!filter) {
return {};
}

// non-deterministic condition or self-referenced variable
if (!node->isDeterministic() || arangodb::iresearch::findReference(*node, *ctx.ref)) {
// not supported by IResearch, but could be handled by ArangoDB
appendExpression(*filter, std::move(node), ctx, filterCtx);
return {};
}

bool result;

if (node->isConstant()) {
result = node->isTrue();
} else { // deterministic expression
ScopedAqlValue value(*node);

if (!value.execute(ctx)) {
// can't execute expression
return {TRI_ERROR_BAD_PARAMETER, "can not execute expression"};
}

result = value.getBoolean();
}

if (result) {
filter->add<irs::all>().boost(filterCtx.boost);
} else {
filter->add<irs::empty>();
}

return {};
}

Result fromExpression(irs::boolean_filter* filter, QueryContext const& ctx,
FilterContext const& filterCtx, aql::AstNode const& node) {
if (!filter) {
Expand Down Expand Up @@ -966,6 +928,15 @@ Result fromExpression(irs::boolean_filter* filter, QueryContext const& ctx,
return {};
}

Result fromExpression(irs::boolean_filter* filter, QueryContext const& ctx,
FilterContext const& filterCtx,
std::shared_ptr<aql::AstNode>&& node) {
// redirect to existing function for AstNode const& nodes to
// avoid coding the logic twice
return fromExpression(filter, ctx, filterCtx, *node);
}


// GEO_IN_RANGE(attribute, shape, lower, upper[, includeLower = true, includeUpper = true])
Result fromFuncGeoInRange(
char const* funcName,
Expand Down
0