org.alfresco.repo.search.impl.parsers
Class AlfrescoFunctionEvaluationContext

java.lang.Object
  extended by org.alfresco.repo.search.impl.parsers.AlfrescoFunctionEvaluationContext
All Implemented Interfaces:
FunctionEvaluationContext

public class AlfrescoFunctionEvaluationContext
extends java.lang.Object
implements FunctionEvaluationContext

Alfrecso function evaluation context for evaluating FTS expressions against lucene.


Constructor Summary
AlfrescoFunctionEvaluationContext(NamespacePrefixResolver namespacePrefixResolver, DictionaryService dictionaryService, java.lang.String defaultNamespace)
           
 
Method Summary
 org.apache.lucene.search.Query buildLuceneEquality(AbstractLuceneQueryParser lqp, java.lang.String propertyName, java.io.Serializable value, PredicateMode mode, LuceneFunction luceneFunction)
           
 org.apache.lucene.search.Query buildLuceneExists(AbstractLuceneQueryParser lqp, java.lang.String propertyName, java.lang.Boolean not)
          Note: null and not null are not required to support functions from the spec
 org.apache.lucene.search.Query buildLuceneGreaterThan(AbstractLuceneQueryParser lqp, java.lang.String propertyName, java.io.Serializable value, PredicateMode mode, LuceneFunction luceneFunction)
           
 org.apache.lucene.search.Query buildLuceneGreaterThanOrEquals(AbstractLuceneQueryParser lqp, java.lang.String propertyName, java.io.Serializable value, PredicateMode mode, LuceneFunction luceneFunction)
           
 org.apache.lucene.search.Query buildLuceneIn(AbstractLuceneQueryParser lqp, java.lang.String propertyName, java.util.Collection values, java.lang.Boolean not, PredicateMode mode)
          Note: In is not required to support functions from the spec
 org.apache.lucene.search.Query buildLuceneInequality(AbstractLuceneQueryParser lqp, java.lang.String propertyName, java.io.Serializable value, PredicateMode mode, LuceneFunction luceneFunction)
           
 org.apache.lucene.search.Query buildLuceneLessThan(AbstractLuceneQueryParser lqp, java.lang.String propertyName, java.io.Serializable value, PredicateMode mode, LuceneFunction luceneFunction)
           
 org.apache.lucene.search.Query buildLuceneLessThanOrEquals(AbstractLuceneQueryParser lqp, java.lang.String propertyName, java.io.Serializable value, PredicateMode mode, LuceneFunction luceneFunction)
           
 org.apache.lucene.search.Query buildLuceneLike(AbstractLuceneQueryParser lqp, java.lang.String propertyName, java.io.Serializable value, java.lang.Boolean not)
          Note: Like is not required to support functions from the spec
 void checkFieldApplies(Selector selector, java.lang.String propertyName)
           
 java.lang.String getLuceneFieldName(java.lang.String propertyName)
           
 LuceneFunction getLuceneFunction(FunctionArgument functionArgument)
           
 java.lang.String getLuceneSortField(AbstractLuceneQueryParser lqp, java.lang.String propertyName)
           
 java.util.Map getNodeRefs()
           
 NodeService getNodeService()
           
 java.io.Serializable getProperty(NodeRef nodeRef, java.lang.String propertyName)
          Get a property
 java.lang.Float getScore()
           
 java.util.Map getScores()
           
 boolean isMultiValued(java.lang.String propertyName)
          Is this a multi-valued property?
 boolean isObjectId(java.lang.String propertyName)
           
 boolean isOrderable(java.lang.String fieldName)
           
 boolean isQueryable(java.lang.String fieldName)
           
 QName stripSuffixes(QName qname)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AlfrescoFunctionEvaluationContext

public AlfrescoFunctionEvaluationContext(NamespacePrefixResolver namespacePrefixResolver,
                                         DictionaryService dictionaryService,
                                         java.lang.String defaultNamespace)
Parameters:
namespacePrefixResolver -
dictionaryService -
defaultNamespace -
Method Detail

buildLuceneEquality

public org.apache.lucene.search.Query buildLuceneEquality(AbstractLuceneQueryParser lqp,
                                                          java.lang.String propertyName,
                                                          java.io.Serializable value,
                                                          PredicateMode mode,
                                                          LuceneFunction luceneFunction)
                                                   throws org.apache.lucene.queryParser.ParseException
Specified by:
buildLuceneEquality in interface FunctionEvaluationContext
Returns:
the query
Throws:
org.apache.lucene.queryParser.ParseException

buildLuceneExists

public org.apache.lucene.search.Query buildLuceneExists(AbstractLuceneQueryParser lqp,
                                                        java.lang.String propertyName,
                                                        java.lang.Boolean not)
                                                 throws org.apache.lucene.queryParser.ParseException
Description copied from interface: FunctionEvaluationContext
Note: null and not null are not required to support functions from the spec

Specified by:
buildLuceneExists in interface FunctionEvaluationContext
Returns:
the query
Throws:
org.apache.lucene.queryParser.ParseException

buildLuceneGreaterThan

public org.apache.lucene.search.Query buildLuceneGreaterThan(AbstractLuceneQueryParser lqp,
                                                             java.lang.String propertyName,
                                                             java.io.Serializable value,
                                                             PredicateMode mode,
                                                             LuceneFunction luceneFunction)
                                                      throws org.apache.lucene.queryParser.ParseException
Specified by:
buildLuceneGreaterThan in interface FunctionEvaluationContext
Returns:
the query
Throws:
org.apache.lucene.queryParser.ParseException

buildLuceneGreaterThanOrEquals

public org.apache.lucene.search.Query buildLuceneGreaterThanOrEquals(AbstractLuceneQueryParser lqp,
                                                                     java.lang.String propertyName,
                                                                     java.io.Serializable value,
                                                                     PredicateMode mode,
                                                                     LuceneFunction luceneFunction)
                                                              throws org.apache.lucene.queryParser.ParseException
Specified by:
buildLuceneGreaterThanOrEquals in interface FunctionEvaluationContext
Returns:
the query
Throws:
org.apache.lucene.queryParser.ParseException

buildLuceneIn

public org.apache.lucene.search.Query buildLuceneIn(AbstractLuceneQueryParser lqp,
                                                    java.lang.String propertyName,
                                                    java.util.Collection values,
                                                    java.lang.Boolean not,
                                                    PredicateMode mode)
                                             throws org.apache.lucene.queryParser.ParseException
Description copied from interface: FunctionEvaluationContext
Note: In is not required to support functions from the spec

Specified by:
buildLuceneIn in interface FunctionEvaluationContext
Returns:
the query
Throws:
org.apache.lucene.queryParser.ParseException

buildLuceneInequality

public org.apache.lucene.search.Query buildLuceneInequality(AbstractLuceneQueryParser lqp,
                                                            java.lang.String propertyName,
                                                            java.io.Serializable value,
                                                            PredicateMode mode,
                                                            LuceneFunction luceneFunction)
                                                     throws org.apache.lucene.queryParser.ParseException
Specified by:
buildLuceneInequality in interface FunctionEvaluationContext
Returns:
the query
Throws:
org.apache.lucene.queryParser.ParseException

buildLuceneLessThan

public org.apache.lucene.search.Query buildLuceneLessThan(AbstractLuceneQueryParser lqp,
                                                          java.lang.String propertyName,
                                                          java.io.Serializable value,
                                                          PredicateMode mode,
                                                          LuceneFunction luceneFunction)
                                                   throws org.apache.lucene.queryParser.ParseException
Specified by:
buildLuceneLessThan in interface FunctionEvaluationContext
Returns:
the query
Throws:
org.apache.lucene.queryParser.ParseException

buildLuceneLessThanOrEquals

public org.apache.lucene.search.Query buildLuceneLessThanOrEquals(AbstractLuceneQueryParser lqp,
                                                                  java.lang.String propertyName,
                                                                  java.io.Serializable value,
                                                                  PredicateMode mode,
                                                                  LuceneFunction luceneFunction)
                                                           throws org.apache.lucene.queryParser.ParseException
Specified by:
buildLuceneLessThanOrEquals in interface FunctionEvaluationContext
Returns:
the query
Throws:
org.apache.lucene.queryParser.ParseException

buildLuceneLike

public org.apache.lucene.search.Query buildLuceneLike(AbstractLuceneQueryParser lqp,
                                                      java.lang.String propertyName,
                                                      java.io.Serializable value,
                                                      java.lang.Boolean not)
                                               throws org.apache.lucene.queryParser.ParseException
Description copied from interface: FunctionEvaluationContext
Note: Like is not required to support functions from the spec

Specified by:
buildLuceneLike in interface FunctionEvaluationContext
Returns:
the query
Throws:
org.apache.lucene.queryParser.ParseException

getLuceneSortField

public java.lang.String getLuceneSortField(AbstractLuceneQueryParser lqp,
                                           java.lang.String propertyName)
Specified by:
getLuceneSortField in interface FunctionEvaluationContext
Returns:
the field used for sorting the given property

getNodeRefs

public java.util.Map getNodeRefs()
Specified by:
getNodeRefs in interface FunctionEvaluationContext
Returns:
the matching nodes by selector (at navigation time)

getNodeService

public NodeService getNodeService()
Specified by:
getNodeService in interface FunctionEvaluationContext
Returns:
the node service

getProperty

public java.io.Serializable getProperty(NodeRef nodeRef,
                                        java.lang.String propertyName)
Description copied from interface: FunctionEvaluationContext
Get a property

Specified by:
getProperty in interface FunctionEvaluationContext
Returns:
the property (at navigation time)

getScore

public java.lang.Float getScore()
Specified by:
getScore in interface FunctionEvaluationContext
Returns:
the score (at navigation time)

getScores

public java.util.Map getScores()
Specified by:
getScores in interface FunctionEvaluationContext
Returns:
the scores by selector (at navigation time)

isObjectId

public boolean isObjectId(java.lang.String propertyName)
Specified by:
isObjectId in interface FunctionEvaluationContext
Returns:
- is this an object id

isOrderable

public boolean isOrderable(java.lang.String fieldName)
Specified by:
isOrderable in interface FunctionEvaluationContext
Returns:
Is this property orderable

isQueryable

public boolean isQueryable(java.lang.String fieldName)
Specified by:
isQueryable in interface FunctionEvaluationContext
Returns:
is this property queryable

getLuceneFieldName

public java.lang.String getLuceneFieldName(java.lang.String propertyName)
Specified by:
getLuceneFieldName in interface FunctionEvaluationContext
Returns:
the lucene field name for the property

stripSuffixes

public QName stripSuffixes(QName qname)

getLuceneFunction

public LuceneFunction getLuceneFunction(FunctionArgument functionArgument)
Specified by:
getLuceneFunction in interface FunctionEvaluationContext
Returns:
the lucene function appropriate to a function argument

checkFieldApplies

public void checkFieldApplies(Selector selector,
                              java.lang.String propertyName)
Specified by:
checkFieldApplies in interface FunctionEvaluationContext

isMultiValued

public boolean isMultiValued(java.lang.String propertyName)
Description copied from interface: FunctionEvaluationContext
Is this a multi-valued property?

Specified by:
isMultiValued in interface FunctionEvaluationContext
Returns:


Copyright © 2005 - 2010 Alfresco Software, Inc. All Rights Reserved.