Interface OIndexableSQLFunction
- All Superinterfaces:
OSQLFunction
- All Known Implementing Classes:
OLuceneCrossClassSearchFunction,OLuceneSearchFunctionTemplate,OLuceneSearchMoreLikeThisFunction,OLuceneSearchOnClassFunction,OLuceneSearchOnFieldsFunction,OLuceneSearchOnIndexFunction,OSpatialFunctionAbstractIndexable,OSTContainsFunction,OSTDistanceSphereFunction,OSTDWithinFunction,OSTIntersectsFunction,OSTWithinFunction
This interface represents SQL functions whose implementation can rely on an index. If used in a
WHERE condition, this kind of function can be invoked to retrieve target records from an
underlying structure, like an index
- Author:
- Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com)
-
Method Summary
Modifier and TypeMethodDescriptionbooleanallowsIndexedExecution(OFromClause target, OBinaryCompareOperator operator, Object rightValue, OCommandContext ctx, OExpression... args) Checks if this function can be used to fetch data from this target and with these arguments (eg. if the index exists on this target and it's defined on these fields)booleancanExecuteInline(OFromClause target, OBinaryCompareOperator operator, Object rightValue, OCommandContext ctx, OExpression... args) checks if the function can be used even on single records, not as an indexed function (even if the index does not exist at all)longestimate(OFromClause target, OBinaryCompareOperator operator, Object rightValue, OCommandContext ctx, OExpression... args) estimates the number of entries returned by searchFromTarget() with these parameterssearchFromTarget(OFromClause target, OBinaryCompareOperator operator, Object rightValue, OCommandContext ctx, OExpression... args) returns all the entries belonging to the target that match the binary condition where this function appearsbooleanshouldExecuteAfterSearch(OFromClause target, OBinaryCompareOperator operator, Object rightValue, OCommandContext ctx, OExpression... args) Checks if this function should be called even if the methodsearchFromTarget(com.orientechnologies.orient.core.sql.parser.OFromClause, com.orientechnologies.orient.core.sql.parser.OBinaryCompareOperator, java.lang.Object, com.orientechnologies.orient.core.command.OCommandContext, com.orientechnologies.orient.core.sql.parser.OExpression...)is executed.Methods inherited from interface com.orientechnologies.orient.core.sql.functions.OSQLFunction
aggregateResults, config, execute, filterResult, getMaxParams, getMinParams, getName, getResult, getSyntax, mergeDistributedResult, setResult, shouldMergeDistributedResult
-
Method Details
-
searchFromTarget
Iterable<OIdentifiable> searchFromTarget(OFromClause target, OBinaryCompareOperator operator, Object rightValue, OCommandContext ctx, OExpression... args) returns all the entries belonging to the target that match the binary condition where this function appears- Parameters:
target- the query targetoperator- the operator after the function, eg. inselect from Foo where myFunction(name) > 4the operator is >rightValue- the value that has to be compared to the function result, eg. inselect from Foo where myFunction(name) > 4the right value is 4ctx- the command context for this queryargs- the function arguments, eg. inselect from Foo where myFunction(name) > 4the arguments are [name]- Returns:
- an iterable of records that match the condition; null means that the execution could not be performed for some reason.
-
estimate
long estimate(OFromClause target, OBinaryCompareOperator operator, Object rightValue, OCommandContext ctx, OExpression... args) estimates the number of entries returned by searchFromTarget() with these parameters- Parameters:
target- the query targetoperator- the operator after the function, eg. inselect from Foo where myFunction(name) > 4the operator is >rightValue- the value that has to be compared to the function result, eg. inselect from Foo where myFunction(name) > 4the right value is 4ctx- the command context for this queryargs- the function arguments, eg. inselect from Foo where myFunction(name) > 4the arguments are [name]- Returns:
- an estimantion of how many entries will be returned by searchFromTarget() with these parameters, -1 if the estimation cannot be done
-
canExecuteInline
boolean canExecuteInline(OFromClause target, OBinaryCompareOperator operator, Object rightValue, OCommandContext ctx, OExpression... args) checks if the function can be used even on single records, not as an indexed function (even if the index does not exist at all)- Parameters:
target- the query targetoperator- the operator after the function, eg. inselect from Foo where myFunction(name) > 4the operator is >rightValue- the value that has to be compared to the function result, eg. inselect from Foo where myFunction(name) > 4the right value is 4ctx- the command context for this queryargs- the function arguments, eg. inselect from Foo where myFunction(name) > 4the arguments are [name]- Returns:
- true if the function can be calculated without the index. False otherwise
-
allowsIndexedExecution
boolean allowsIndexedExecution(OFromClause target, OBinaryCompareOperator operator, Object rightValue, OCommandContext ctx, OExpression... args) Checks if this function can be used to fetch data from this target and with these arguments (eg. if the index exists on this target and it's defined on these fields)- Parameters:
target- the query targetoperator- the operator after the function, eg. inselect from Foo where myFunction(name) > 4the operator is >rightValue- the value that has to be compared to the function result, eg. inselect from Foo where myFunction(name) > 4the right value is 4ctx- the command context for this queryargs- the function arguments, eg. inselect from Foo where myFunction(name) > 4the arguments are [name]- Returns:
- True if the function can be used to fetch from an index. False otherwise
-
shouldExecuteAfterSearch
boolean shouldExecuteAfterSearch(OFromClause target, OBinaryCompareOperator operator, Object rightValue, OCommandContext ctx, OExpression... args) Checks if this function should be called even if the methodsearchFromTarget(com.orientechnologies.orient.core.sql.parser.OFromClause, com.orientechnologies.orient.core.sql.parser.OBinaryCompareOperator, java.lang.Object, com.orientechnologies.orient.core.command.OCommandContext, com.orientechnologies.orient.core.sql.parser.OExpression...)is executed.- Parameters:
target- the query targetoperator- the operator after the function, eg. inselect from Foo where myFunction(name) > 4the operator is >rightValue- the value that has to be compared to the function result, eg. inselect from Foo where myFunction(name) > 4the right value is 4ctx- the command context for this queryargs- the function arguments, eg. inselect from Foo where myFunction(name) > 4the arguments are [name]- Returns:
- True if this function should be called even if the method
searchFromTarget(com.orientechnologies.orient.core.sql.parser.OFromClause, com.orientechnologies.orient.core.sql.parser.OBinaryCompareOperator, java.lang.Object, com.orientechnologies.orient.core.command.OCommandContext, com.orientechnologies.orient.core.sql.parser.OExpression...)is executed. False otherwise
-