arangod/IResearch/IResearchFeature.cpp
/// Executes MIN_MATCH function with const parameters locally the same way it will be done in ArangoSearch on runtime
/// This will allow optimize out MIN_MATCH call if all arguments are const
Executes MIN_MATCH function with const parameters locally the same way it will be done in ArangoSearch on runtime
This will allow optimize out MIN_MATCH call if all arguments are const
Executes MIN_MATCH function with const parameters locally the same way it will be done in ArangoSearch on runtime This will allow optimize out MIN_MATCH call if all arguments are const
arangodb::aql::AqlValue dummyMinMatchContextFunc(
    arangodb::aql::ExpressionContext*, arangodb::transaction::Methods*,
    ::arangodb::containers::SmallVector<arangodb::aql::AqlValue> const& args) {
  TRI_ASSERT(args.size() > 1); 
  auto& minMatchValue = args.back();
  if (ADB_LIKELY(minMatchValue.isNumber())) {
    auto matchesLeft = minMatchValue.toInt64();
    const auto argsCount = args.size() - 1;
    for (size_t i = 0; i < argsCount && matchesLeft > 0; ++i) {
      auto& currValue = args[i];
      if (currValue.toBoolean()) {
        matchesLeft--;
      }
    }
    return arangodb::aql::AqlValue(arangodb::aql::AqlValueHintBool(matchesLeft == 0));
  } else {
    auto message = std::string("'MIN_MATCH' AQL function: ")
                     .append(" last argument has invalid type '") 
                     .append(minMatchValue.getTypeString())
                     .append("' (numeric expected)");
    THROW_ARANGO_EXCEPTION_MESSAGE(
      TRI_ERROR_BAD_PARAMETER,
      message);
  }
}
arangodb :: aql :: AqlValue dummyMinMatchContextFunc ( arangodb :: aql :: ExpressionContext * , arangodb :: transaction :: Methods * , :: arangodb :: containers :: SmallVector < arangodb :: aql :: AqlValue > const & args ) { TRI_ASSERT ( args . size ( ) > 1 ) ; auto & minMatchValue = args . back ( ) ; if ( ADB_LIKELY ( minMatchValue . isNumber ( ) ) ) { auto matchesLeft = minMatchValue . toInt64 ( ) ; const auto argsCount = args . size ( ) - 1 ; for ( size_t i = 0 ; i < argsCount && matchesLeft > 0 ; ++ i ) { auto & currValue = args [ i ] ; if ( currValue . toBoolean ( ) ) { matchesLeft -- ; } } return arangodb :: aql :: AqlValue ( arangodb :: aql :: AqlValueHintBool ( matchesLeft == 0 ) ) ; } else { auto message = std :: string ( " " ) . append ( " " ) . append ( minMatchValue . getTypeString ( ) ) . append ( " " ) ; THROW_ARANGO_EXCEPTION_MESSAGE ( TRI_ERROR_BAD_PARAMETER , message ) ; } }
Executes MIN_MATCH function with const parameters locally the same way it will be done in ArangoSearch on runtime
This will allow optimize out MIN_MATCH call if all arguments are const
Executes MIN_MATCH function with const parameters locally the same way it will be done in ArangoSearch on runtime This will allow optimize out MIN_MATCH call if all arguments are const
// ensured by function signature