Class AlfrescoFunctionEvaluationContext
- java.lang.Object
-
- org.alfresco.repo.search.impl.parsers.AlfrescoFunctionEvaluationContext
-
- All Implemented Interfaces:
FunctionEvaluationContext
public class AlfrescoFunctionEvaluationContext extends Object implements FunctionEvaluationContext
Alfrecso function evaluation context for evaluating FTS expressions against lucene.- Author:
- andyh
-
-
Constructor Summary
Constructors Constructor Description AlfrescoFunctionEvaluationContext(NamespacePrefixResolver namespacePrefixResolver, DictionaryService dictionaryService, String defaultNamespace)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <Q,S,E extends Throwable>
QbuildLuceneEquality(LuceneQueryParserAdaptor<Q,S,E> lqpa, String propertyName, Serializable value, PredicateMode mode, LuceneFunction luceneFunction)
<Q,S,E extends Throwable>
QbuildLuceneExists(LuceneQueryParserAdaptor<Q,S,E> lqpa, String propertyName, Boolean not)
Note: null and not null are not required to support functions from the spec<Q,S,E extends Throwable>
QbuildLuceneGreaterThan(LuceneQueryParserAdaptor<Q,S,E> lqpa, String propertyName, Serializable value, PredicateMode mode, LuceneFunction luceneFunction)
<Q,S,E extends Throwable>
QbuildLuceneGreaterThanOrEquals(LuceneQueryParserAdaptor<Q,S,E> lqpa, String propertyName, Serializable value, PredicateMode mode, LuceneFunction luceneFunction)
<Q,S,E extends Throwable>
QbuildLuceneIn(LuceneQueryParserAdaptor<Q,S,E> lqpa, String propertyName, Collection<Serializable> values, Boolean not, PredicateMode mode)
Note: In is not required to support functions from the spec<Q,S,E extends Throwable>
QbuildLuceneInequality(LuceneQueryParserAdaptor<Q,S,E> lqpa, String propertyName, Serializable value, PredicateMode mode, LuceneFunction luceneFunction)
<Q,S,E extends Throwable>
QbuildLuceneLessThan(LuceneQueryParserAdaptor<Q,S,E> lqpa, String propertyName, Serializable value, PredicateMode mode, LuceneFunction luceneFunction)
<Q,S,E extends Throwable>
QbuildLuceneLessThanOrEquals(LuceneQueryParserAdaptor<Q,S,E> lqpa, String propertyName, Serializable value, PredicateMode mode, LuceneFunction luceneFunction)
<Q,S,E extends Throwable>
QbuildLuceneLike(LuceneQueryParserAdaptor<Q,S,E> lqpa, String propertyName, Serializable value, Boolean not)
Note: Like is not required to support functions from the specvoid
checkFieldApplies(Selector selector, String propertyName)
String
getAlfrescoPropertyName(String propertyName)
String
getAlfrescoTypeName(String typeName)
String
getLuceneFieldName(String propertyName)
LuceneFunction
getLuceneFunction(FunctionArgument functionArgument)
<Q,S,E extends Throwable>
StringgetLuceneSortField(LuceneQueryParserAdaptor<Q,S,E> lqpa, String propertyName)
Map<String,NodeRef>
getNodeRefs()
NodeService
getNodeService()
Serializable
getProperty(NodeRef nodeRef, String propertyName)
Get a propertyFloat
getScore()
Map<String,Float>
getScores()
boolean
isMultiValued(String propertyName)
Is this a multi-valued property?boolean
isObjectId(String propertyName)
boolean
isOrderable(String fieldName)
boolean
isQueryable(String fieldName)
QName
stripSuffixes(QName qname)
-
-
-
Constructor Detail
-
AlfrescoFunctionEvaluationContext
public AlfrescoFunctionEvaluationContext(NamespacePrefixResolver namespacePrefixResolver, DictionaryService dictionaryService, String defaultNamespace)
- Parameters:
namespacePrefixResolver
- NamespacePrefixResolverdictionaryService
- DictionaryServicedefaultNamespace
- String
-
-
Method Detail
-
buildLuceneEquality
public <Q,S,E extends Throwable> Q buildLuceneEquality(LuceneQueryParserAdaptor<Q,S,E> lqpa, String propertyName, Serializable value, PredicateMode mode, LuceneFunction luceneFunction) throws E extends Throwable
- Specified by:
buildLuceneEquality
in interfaceFunctionEvaluationContext
propertyName
- Stringvalue
- Serializablemode
- PredicateModeluceneFunction
- LuceneFunction- Returns:
- the query
- Throws:
E
E extends Throwable
-
buildLuceneExists
public <Q,S,E extends Throwable> Q buildLuceneExists(LuceneQueryParserAdaptor<Q,S,E> lqpa, String propertyName, Boolean not) throws E extends Throwable
Description copied from interface:FunctionEvaluationContext
Note: null and not null are not required to support functions from the spec- Specified by:
buildLuceneExists
in interfaceFunctionEvaluationContext
propertyName
- Stringnot
- Boolean- Returns:
- the query
- Throws:
E
E extends Throwable
-
buildLuceneGreaterThan
public <Q,S,E extends Throwable> Q buildLuceneGreaterThan(LuceneQueryParserAdaptor<Q,S,E> lqpa, String propertyName, Serializable value, PredicateMode mode, LuceneFunction luceneFunction) throws E extends Throwable
- Specified by:
buildLuceneGreaterThan
in interfaceFunctionEvaluationContext
propertyName
- Stringvalue
- Serializablemode
- PredicateModeluceneFunction
- LuceneFunction- Returns:
- the query
- Throws:
E
E extends Throwable
-
buildLuceneGreaterThanOrEquals
public <Q,S,E extends Throwable> Q buildLuceneGreaterThanOrEquals(LuceneQueryParserAdaptor<Q,S,E> lqpa, String propertyName, Serializable value, PredicateMode mode, LuceneFunction luceneFunction) throws E extends Throwable
- Specified by:
buildLuceneGreaterThanOrEquals
in interfaceFunctionEvaluationContext
propertyName
- Stringvalue
- Serializablemode
- PredicateModeluceneFunction
- LuceneFunction- Returns:
- the query
- Throws:
E
E extends Throwable
-
buildLuceneIn
public <Q,S,E extends Throwable> Q buildLuceneIn(LuceneQueryParserAdaptor<Q,S,E> lqpa, String propertyName, Collection<Serializable> values, Boolean not, PredicateMode mode) throws E extends Throwable
Description copied from interface:FunctionEvaluationContext
Note: In is not required to support functions from the spec- Specified by:
buildLuceneIn
in interfaceFunctionEvaluationContext
propertyName
- Stringnot
- Booleanmode
- PredicateMode- Returns:
- the query
- Throws:
E
E extends Throwable
-
buildLuceneInequality
public <Q,S,E extends Throwable> Q buildLuceneInequality(LuceneQueryParserAdaptor<Q,S,E> lqpa, String propertyName, Serializable value, PredicateMode mode, LuceneFunction luceneFunction) throws E extends Throwable
- Specified by:
buildLuceneInequality
in interfaceFunctionEvaluationContext
propertyName
- Stringvalue
- Serializablemode
- PredicateModeluceneFunction
- LuceneFunction- Returns:
- the query
- Throws:
E
E extends Throwable
-
buildLuceneLessThan
public <Q,S,E extends Throwable> Q buildLuceneLessThan(LuceneQueryParserAdaptor<Q,S,E> lqpa, String propertyName, Serializable value, PredicateMode mode, LuceneFunction luceneFunction) throws E extends Throwable
- Specified by:
buildLuceneLessThan
in interfaceFunctionEvaluationContext
propertyName
- Stringvalue
- Serializablemode
- PredicateModeluceneFunction
- LuceneFunction- Returns:
- the query
- Throws:
E
E extends Throwable
-
buildLuceneLessThanOrEquals
public <Q,S,E extends Throwable> Q buildLuceneLessThanOrEquals(LuceneQueryParserAdaptor<Q,S,E> lqpa, String propertyName, Serializable value, PredicateMode mode, LuceneFunction luceneFunction) throws E extends Throwable
- Specified by:
buildLuceneLessThanOrEquals
in interfaceFunctionEvaluationContext
propertyName
- Stringvalue
- Serializablemode
- PredicateModeluceneFunction
- LuceneFunction- Returns:
- the query
- Throws:
E
E extends Throwable
-
buildLuceneLike
public <Q,S,E extends Throwable> Q buildLuceneLike(LuceneQueryParserAdaptor<Q,S,E> lqpa, String propertyName, Serializable value, Boolean not) throws E extends Throwable
Description copied from interface:FunctionEvaluationContext
Note: Like is not required to support functions from the spec- Specified by:
buildLuceneLike
in interfaceFunctionEvaluationContext
propertyName
- Stringvalue
- Serializablenot
- Boolean- Returns:
- the query
- Throws:
E
E extends Throwable
-
getLuceneSortField
public <Q,S,E extends Throwable> String getLuceneSortField(LuceneQueryParserAdaptor<Q,S,E> lqpa, String propertyName) throws E extends Throwable
- Specified by:
getLuceneSortField
in interfaceFunctionEvaluationContext
propertyName
- String- Returns:
- the field used for sorting the given property
- Throws:
E
E extends Throwable
-
getNodeRefs
public Map<String,NodeRef> getNodeRefs()
- Specified by:
getNodeRefs
in interfaceFunctionEvaluationContext
- Returns:
- the matching nodes by selector (at navigation time)
-
getNodeService
public NodeService getNodeService()
- Specified by:
getNodeService
in interfaceFunctionEvaluationContext
- Returns:
- the node service
-
getProperty
public Serializable getProperty(NodeRef nodeRef, String propertyName)
Description copied from interface:FunctionEvaluationContext
Get a property- Specified by:
getProperty
in interfaceFunctionEvaluationContext
- Parameters:
nodeRef
- NodeRefpropertyName
- String- Returns:
- the property (at navigation time)
-
getScore
public Float getScore()
- Specified by:
getScore
in interfaceFunctionEvaluationContext
- Returns:
- the score (at navigation time)
-
getScores
public Map<String,Float> getScores()
- Specified by:
getScores
in interfaceFunctionEvaluationContext
- Returns:
- the scores by selector (at navigation time)
-
isObjectId
public boolean isObjectId(String propertyName)
- Specified by:
isObjectId
in interfaceFunctionEvaluationContext
- Parameters:
propertyName
- String- Returns:
- - is this an object id
-
isOrderable
public boolean isOrderable(String fieldName)
- Specified by:
isOrderable
in interfaceFunctionEvaluationContext
- Parameters:
fieldName
- String- Returns:
- Is this property orderable
-
isQueryable
public boolean isQueryable(String fieldName)
- Specified by:
isQueryable
in interfaceFunctionEvaluationContext
- Parameters:
fieldName
- String- Returns:
- is this property queryable
-
getLuceneFieldName
public String getLuceneFieldName(String propertyName)
- Specified by:
getLuceneFieldName
in interfaceFunctionEvaluationContext
- Parameters:
propertyName
- String- Returns:
- the lucene field name for the property
-
getLuceneFunction
public LuceneFunction getLuceneFunction(FunctionArgument functionArgument)
- Specified by:
getLuceneFunction
in interfaceFunctionEvaluationContext
- Parameters:
functionArgument
- FunctionArgument- Returns:
- the lucene function appropriate to a function argument
-
checkFieldApplies
public void checkFieldApplies(Selector selector, String propertyName)
- Specified by:
checkFieldApplies
in interfaceFunctionEvaluationContext
- Parameters:
selector
- SelectorpropertyName
- String
-
isMultiValued
public boolean isMultiValued(String propertyName)
Description copied from interface:FunctionEvaluationContext
Is this a multi-valued property?- Specified by:
isMultiValued
in interfaceFunctionEvaluationContext
- Parameters:
propertyName
- String- Returns:
- boolean
-
getAlfrescoPropertyName
public String getAlfrescoPropertyName(String propertyName)
- Specified by:
getAlfrescoPropertyName
in interfaceFunctionEvaluationContext
-
getAlfrescoTypeName
public String getAlfrescoTypeName(String typeName)
- Specified by:
getAlfrescoTypeName
in interfaceFunctionEvaluationContext
- Parameters:
typeName
- String- Returns:
- String
-
-