Class OLuceneSearchOnClassFunction
java.lang.Object
com.orientechnologies.orient.core.sql.functions.OSQLFunctionAbstract
com.orientechnologies.lucene.functions.OLuceneSearchFunctionTemplate
com.orientechnologies.lucene.functions.OLuceneSearchOnClassFunction
- All Implemented Interfaces:
OIndexableSQLFunction,OSQLFunction
Created by frank on 15/01/2017.
-
Field Summary
FieldsFields inherited from class com.orientechnologies.orient.core.sql.functions.OSQLFunctionAbstract
maxParams, minParams, name -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleancanExecuteInline(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)execute(Object iThis, OIdentifiable iCurrentRecord, Object iCurrentResult, Object[] params, OCommandContext ctx) Process a record.booleanA function can act both as transformation or filtering records.getName()Function name, the name is used by the sql parser to identify a call this function.Returns a convenient SQL String representation of the function.protected OLuceneFullTextIndexsearchForIndex(OFromClause target, OCommandContext ctx, OExpression... args) 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 appearsMethods inherited from class com.orientechnologies.lucene.functions.OLuceneSearchFunctionTemplate
allowsIndexedExecution, estimate, getMetadata, shouldExecuteAfterSearchMethods inherited from class com.orientechnologies.orient.core.sql.functions.OSQLFunctionAbstract
aggregateResults, config, getDatabase, getDistributedStorageId, getMaxParams, getMinParams, 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.OSQLFunction
aggregateResults, config, getMaxParams, getMinParams, getResult, mergeDistributedResult, setResult, shouldMergeDistributedResult
-
Field Details
-
NAME
- See Also:
-
-
Constructor Details
-
OLuceneSearchOnClassFunction
public OLuceneSearchOnClassFunction()
-
-
Method Details
-
getName
Description copied from interface:OSQLFunctionFunction name, the name is used by the sql parser to identify a call this function.- Specified by:
getNamein interfaceOSQLFunction- Overrides:
getNamein classOSQLFunctionAbstract- Returns:
- String , function name, never null or empty.
-
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- Overrides:
canExecuteInlinein classOLuceneSearchFunctionTemplate- 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
-
execute
public Object execute(Object iThis, OIdentifiable iCurrentRecord, Object iCurrentResult, Object[] params, OCommandContext ctx) Description copied from interface:OSQLFunctionProcess a record.iCurrentRecord- : current recordiCurrentResult- TODOparams- : function parameters, number is ensured to be within minParams and maxParams.ctx- : object calling this function- Returns:
- function result, can be null. Special cases : can be null if function aggregate results, can be null if function filter results : this mean result is excluded
-
getSyntax
Description copied from interface:OSQLFunctionReturns a convenient SQL String representation of the function.Example :
myFunction( param1, param2, [optionalParam3])
This text will be used in exception messages.
- Returns:
- String , never null.
-
filterResult
public boolean filterResult()Description copied from interface:OSQLFunctionA function can act both as transformation or filtering records. If the function may reduce the number final records than it must return true.Function should return null for the execute method if the record must be excluded.
- Specified by:
filterResultin interfaceOSQLFunction- Overrides:
filterResultin classOSQLFunctionAbstract- Returns:
- true if the function acts as a record filter.
-
searchFromTarget
public Iterable<OIdentifiable> searchFromTarget(OFromClause target, OBinaryCompareOperator operator, Object rightValue, OCommandContext ctx, OExpression... args) Description copied from interface:OIndexableSQLFunctionreturns 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.
-
searchForIndex
protected OLuceneFullTextIndex searchForIndex(OFromClause target, OCommandContext ctx, OExpression... args) - Specified by:
searchForIndexin classOLuceneSearchFunctionTemplate
-