Class OLuceneSearchFunctionTemplate
java.lang.Object
com.orientechnologies.orient.core.sql.functions.OSQLFunctionAbstract
com.orientechnologies.lucene.functions.OLuceneSearchFunctionTemplate
- All Implemented Interfaces:
OIndexableSQLFunction,OSQLFunction
- Direct Known Subclasses:
OLuceneSearchOnClassFunction,OLuceneSearchOnFieldsFunction,OLuceneSearchOnIndexFunction
public abstract class OLuceneSearchFunctionTemplate
extends OSQLFunctionAbstract
implements OIndexableSQLFunction
Created by frank on 25/05/2017.
-
Field Summary
Fields inherited from class com.orientechnologies.orient.core.sql.functions.OSQLFunctionAbstract
maxParams, minParams, name -
Constructor Summary
Constructors -
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 parametersprotected ODocumentgetMetadata(OExpression metadata, OCommandContext ctx) protected abstract OLuceneFullTextIndexsearchForIndex(OFromClause target, OCommandContext ctx, OExpression... args) booleanshouldExecuteAfterSearch(OFromClause target, OBinaryCompareOperator operator, Object rightValue, OCommandContext ctx, OExpression... args) Checks if this function should be called even if the methodOIndexableSQLFunction.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.Methods inherited from class com.orientechnologies.orient.core.sql.functions.OSQLFunctionAbstract
aggregateResults, config, filterResult, getDatabase, getDistributedStorageId, getMaxParams, getMinParams, getName, getResult, getSingleItem, getSingleProperty, mergeDistributedResult, returnDistributedResult, setResult, shouldMergeDistributedResult, toStringMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface com.orientechnologies.orient.core.sql.functions.OIndexableSQLFunction
searchFromTargetMethods inherited from interface com.orientechnologies.orient.core.sql.functions.OSQLFunction
aggregateResults, config, execute, filterResult, getMaxParams, getMinParams, getName, getResult, getSyntax, mergeDistributedResult, setResult, shouldMergeDistributedResult
-
Constructor Details
-
OLuceneSearchFunctionTemplate
-
-
Method Details
-
canExecuteInline
public boolean canExecuteInline(OFromClause target, OBinaryCompareOperator operator, Object rightValue, OCommandContext ctx, OExpression... args) Description copied from interface:OIndexableSQLFunctionchecks if the function can be used even on single records, not as an indexed function (even if the index does not exist at all)- Specified by:
canExecuteInlinein interfaceOIndexableSQLFunction- 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
public boolean allowsIndexedExecution(OFromClause target, OBinaryCompareOperator operator, Object rightValue, OCommandContext ctx, OExpression... args) Description copied from interface:OIndexableSQLFunctionChecks 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)- Specified by:
allowsIndexedExecutionin interfaceOIndexableSQLFunction- 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
public boolean shouldExecuteAfterSearch(OFromClause target, OBinaryCompareOperator operator, Object rightValue, OCommandContext ctx, OExpression... args) Description copied from interface:OIndexableSQLFunctionChecks if this function should be called even if the methodOIndexableSQLFunction.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.- Specified by:
shouldExecuteAfterSearchin interfaceOIndexableSQLFunction- 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
OIndexableSQLFunction.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
-
estimate
public long estimate(OFromClause target, OBinaryCompareOperator operator, Object rightValue, OCommandContext ctx, OExpression... args) Description copied from interface:OIndexableSQLFunctionestimates the number of entries returned by searchFromTarget() with these parameters- Specified by:
estimatein interfaceOIndexableSQLFunction- 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
-
getMetadata
-
searchForIndex
protected abstract OLuceneFullTextIndex searchForIndex(OFromClause target, OCommandContext ctx, OExpression... args)
-