Package com.attivio.sdk.search.fields
Class FieldExpression
- java.lang.Object
-
- com.attivio.sdk.search.fields.FieldExpression
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Cloneable
- Direct Known Subclasses:
BinaryFieldExpression
,Condition
,Constant
,CurrentTime
,DocBoost
,FieldLength
,Locate
,MatchingFields
,MatchingTerms
,MultiaryFieldExpression
,NumDocs
,PartitionId
,PhraseMatch
,PhraseScore
,QueryParameter
,ScopeField
,ScopeFrequency
,ScopeVector
,ScoreExplain
,StoredField
,Switch
,TermVector
,TotalScopeFrequency
,TotalTermFrequency
,UnaryFieldExpression
,UserDefinedField
public abstract class FieldExpression extends java.lang.Object implements java.lang.Cloneable, java.io.Serializable
Base class for field expressions.A FieldExpression represents a column or field that is returned in a
SearchDocument
.- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static class
FieldExpression.StringMode
Mode for serializingFieldExpression
to a string.
-
Field Summary
Fields Modifier and Type Field Description protected static FieldExpression[]
EMPTY_ARRAY
Empty array of field expressions.
-
Constructor Summary
Constructors Modifier Constructor Description protected
FieldExpression()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected static FieldExpression
apply(java.util.function.Function<FieldExpression,FieldExpression> handler, FieldExpression input)
FieldExpression
clone()
static FieldExpression[]
copyOf(FieldExpression[] args, int length)
Create a copy ofargs
.FieldExpression
forEachField(java.util.function.Function<FieldExpression,FieldExpression> handler)
Applieshandler
for eachFieldExpression
argument.FieldExpression
forEachPhrase(PhraseHandler handler)
Applieshandler
for eachPhrase
argument.FieldExpression
forEachQuery(QueryHandler handler)
Applieshandler
for eachQuery
argument.java.lang.String
getDefaultName()
Get the default name to use for this FieldExpression.java.lang.String
getFieldName()
Get the field name for this expression.abstract SchemaField.Type
getType(Schema schema)
Resolve the type for this expression.abstract boolean
hasChildren()
Returnstrue
if this field expression has any sub FieldExpressions.int
hashCode()
abstract boolean
isConstant()
Returnstrue
if this field expression evaluates to a constant value.protected static boolean
isConstant(FieldExpression value)
protected static FieldExpression
parse(StringParser parser)
protected static void
quote(java.lang.StringBuilder buffer, java.lang.String text)
Addtext
tobuffer
as quoted string.void
rewrite(QueryHandler handler, boolean recursive)
Rewrite any query objects in this FieldExpression usinghandler
.protected static void
rewrite(QueryHandler handler, boolean recursive, FieldExpression input)
FieldExpression
rewriteChildren(FieldExpressionHandler handler)
Deprecated.useforEachField(Function)
instead.java.lang.String
toString()
Return String representation of expression.void
toString(java.lang.StringBuilder buffer)
Writes the string representation of this field expression tobuffer
.protected abstract void
toString(java.lang.StringBuilder buffer, FieldExpression.StringMode mode)
Writes the string representation of this field expression tobuffer
.static FieldExpression
valueOf(java.lang.String value)
-
-
-
Field Detail
-
EMPTY_ARRAY
protected static final FieldExpression[] EMPTY_ARRAY
Empty array of field expressions.
-
-
Method Detail
-
getType
public abstract SchemaField.Type getType(Schema schema)
Resolve the type for this expression.
-
isConstant
public abstract boolean isConstant()
Returnstrue
if this field expression evaluates to a constant value.
-
getDefaultName
public final java.lang.String getDefaultName()
Get the default name to use for this FieldExpression.
-
getFieldName
public java.lang.String getFieldName()
Get the field name for this expression.This is used as a hint to the search engine to tie back to the schema. null may be returned if this expression contains no field. If this expression is composed of many fields, this can be either the "primary" field for the expression, or null.
-
hasChildren
public abstract boolean hasChildren()
Returnstrue
if this field expression has any sub FieldExpressions.
-
rewriteChildren
@Deprecated public final FieldExpression rewriteChildren(FieldExpressionHandler handler)
Deprecated.useforEachField(Function)
instead.Traverse this FieldExpression usinghandler
to visit/rewrite direct child elements if this expression.NOTE: this method traverses direct child expressions (if any) only.
-
rewrite
public void rewrite(QueryHandler handler, boolean recursive)
Rewrite any query objects in this FieldExpression usinghandler
.
-
forEachField
public FieldExpression forEachField(java.util.function.Function<FieldExpression,FieldExpression> handler)
-
forEachQuery
public FieldExpression forEachQuery(QueryHandler handler)
-
forEachPhrase
public FieldExpression forEachPhrase(PhraseHandler handler)
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
toString
public final java.lang.String toString()
Return String representation of expression.- Overrides:
toString
in classjava.lang.Object
-
toString
public final void toString(java.lang.StringBuilder buffer)
Writes the string representation of this field expression tobuffer
.
-
toString
protected abstract void toString(java.lang.StringBuilder buffer, FieldExpression.StringMode mode)
Writes the string representation of this field expression tobuffer
.
-
quote
protected static void quote(java.lang.StringBuilder buffer, java.lang.String text)
Addtext
tobuffer
as quoted string.NOTE: value will only be quoted if it contains non-alphanumeric characters.
-
clone
public FieldExpression clone()
- Overrides:
clone
in classjava.lang.Object
-
isConstant
protected static boolean isConstant(FieldExpression value)
-
apply
protected static FieldExpression apply(java.util.function.Function<FieldExpression,FieldExpression> handler, FieldExpression input)
-
rewrite
protected static void rewrite(QueryHandler handler, boolean recursive, FieldExpression input)
-
copyOf
public static final FieldExpression[] copyOf(FieldExpression[] args, int length)
Create a copy ofargs
.
-
parse
protected static FieldExpression parse(StringParser parser)
-
valueOf
public static FieldExpression valueOf(java.lang.String value)
-
-