public class DefaultExpression extends Object implements Expression
Expression
.Expression
Constructor and Description |
---|
DefaultExpression()
Creates a
DefaultExpression with default parameters. |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object pOther) |
int[] |
getExcludedNodes()
Returns the ids of nodes to exclude from this expression.
|
Date |
getFromDate()
Returns the from date limit.
|
int |
getId()
Returns the id used for this expression.
|
String |
getMatch()
Deprecated.
Use
getSearchString() instead. |
int |
getMaxSearchRows()
Returns the maximum number of rows (objects) requested by this expression.
|
int[] |
getNodes()
Returns the ids of the nodes this expression will search in.
|
Object |
getParameter(String pName)
Returns extra the parameter for a given value, used by the search engine implementation.
|
int |
getPublicationID()
Deprecated.
This method has no effect. To constrain hits to a particular publication,
constrain the expression to the publication's root section instead.
|
String |
getSearchString()
Returns the free-text search expression.
|
String |
getSort()
Returns the field used for sort ordering in this expression.
|
String[] |
getStates()
Returns the states this expression includes.
|
Date |
getToDate()
Returns the to date limit.
|
String[] |
getTypes()
Returns the types in this expression.
|
int |
hashCode() |
boolean |
isDescendingSort()
Returns whether the result should be sorted in descending or ascending order.
|
boolean |
isLive()
Returns whether the expression should include only live content.
|
boolean |
isSearchSubNodes()
Returns whether this expression includes sub-nodes or not.
|
void |
setDescendingSort(boolean pDescending)
Specifies whether the result should be sorted in descending or ascending order.
|
void |
setExcludedNodes(int[] pExcludedNodes)
Sets the ids of nodes to exclude from this expression.
|
void |
setFromDate(Date pFromDate)
Limits the search to objects newer than this.
|
void |
setId(int pId)
Sets the id of the object to search for.
|
void |
setLive(boolean pLive)
Specifies whether the expression includes only live content.
|
void |
setMaxSearchRows(int pMaxSearchRows)
Sets the maximum number of rows (objects) requested by this expression.
|
void |
setNodes(int[] pNodes)
Restricts the search to a portion of the hierarchical structure.
|
void |
setParameter(String pName,
Object pValue)
Specifies an extra parameter passed to the search engine implementation.
|
void |
setPublicationID(int pPublicationId)
Deprecated.
This method has no effect. To constrain hits to a particular publication,
constrain the expression to the publication's root section instead.
|
void |
setSearchString(String pExpression)
Sets the free-text search expression.
|
void |
setSearchSubNodes(boolean pInclude)
Specifies whether this expression includes sub-nodes or not.
|
void |
setSort(String pOrderBy)
Specifies the field used for sort ordering in this expression.
|
void |
setStates(String[] pStates)
Sepcifies the states this expression includes.
|
void |
setToDate(Date pToDate)
Limit the search to objects older than this.
|
void |
setTypes(String[] pTypes)
Specifies what content types this expression includes.
|
String |
toString() |
public DefaultExpression()
DefaultExpression
with default parameters.public void setId(int pId)
Expression
-1
, meaning all ids.setId
in interface Expression
pId
- the idpublic int getId()
Expression
getId
in interface Expression
Expression.setId(int)
public void setMaxSearchRows(int pMaxSearchRows)
Expression
-1
, meaning all rows will be returned.setMaxSearchRows
in interface Expression
pMaxSearchRows
- the maximum number of rows (objects) requested by this expression.public int getMaxSearchRows()
Expression
getMaxSearchRows
in interface Expression
Expression.setMaxSearchRows(int)
public void setPublicationID(int pPublicationId)
pPublicationId
- the publication idsetNodes(int[])
public int getPublicationID()
-1
, alwayssetNodes(int[])
public void setSearchString(String pExpression)
Expression
QueryTranslator
to generate a syntax recognized by the
underlying search engine.
There is no default value.
To search for any object, use "*"
. The default syntax uses
"*"
is wildcard. Search words are separated by space, +/- as
prefix means AND/NOT respectively. To search in specific fields, prefix the
expression with the field name and colon.
Examples: *
- searches for all objectstitle:news
- searches for "news" in the title fieldnews -old
- searches for "news" in all fields, not containing
"old"setSearchString
in interface Expression
pExpression
- the text to search for.QueryTranslator
public String getSearchString()
Expression
getSearchString
in interface Expression
Expression.setSearchString(String)
public String getMatch()
getSearchString()
instead.public void setSort(String pOrderBy)
Expression
"score"
, to order by score (sometimes referred to as "relevance").
The algorithm to compute score is specific to the search engine.
Supported values are "score"
, "lastModifiedDate"
or "publishDate"
.setSort
in interface Expression
pOrderBy
- the field to use for sortingpublic String getSort()
Expression
getSort
in interface Expression
Expression.setSort(String)
public void setNodes(int[] pNodes)
Expression
Article
s this will be the Section
structure. For
Image
s, Link
s and Multimedia
this will be the
Catalog
structure.
The default is null
, which means the search will search in all
nodes of the relevant type.setNodes
in interface Expression
pNodes
- The ids of theo nodes to search in.public int[] getNodes()
Expression
getNodes
in interface Expression
Expression.setNodes(int[])
public void setExcludedNodes(int[] pExcludedNodes)
Expression
null
, which means don't exclude any nodes.setExcludedNodes
in interface Expression
pExcludedNodes
- The ids of the nodes to exclude.Expression.setNodes(int[])
public int[] getExcludedNodes()
Expression
getExcludedNodes
in interface Expression
Expression.setExcludedNodes(int[])
public void setSearchSubNodes(boolean pInclude)
Expression
true
, which means search-sub nodes.setSearchSubNodes
in interface Expression
pInclude
- If true
this expression will include sub-nodes of all nodes specified.Expression.setNodes(int[])
public boolean isSearchSubNodes()
Expression
isSearchSubNodes
in interface Expression
Expression.setSearchSubNodes(boolean)
public void setFromDate(Date pFromDate)
Expression
setFromDate
in interface Expression
pFromDate
- the first date to include, or null
Expression.setToDate(java.util.Date)
public Date getFromDate()
Expression
getFromDate
in interface Expression
Expression.setFromDate(java.util.Date)
public void setToDate(Date pToDate)
Expression
setToDate
in interface Expression
pToDate
- the last date to include, or null
Expression.setFromDate(java.util.Date)
public Date getToDate()
Expression
getToDate
in interface Expression
Expression.setToDate(java.util.Date)
public void setTypes(String[] pTypes)
Expression
ReferenceEntity
objects this will be "Image", "Link", "Media" or "Person".
If no types are given, the default is to search for all types.setTypes
in interface Expression
pTypes
- The types to search for, or null
to seach for all typespublic String[] getTypes()
Expression
getTypes
in interface Expression
Expression.setTypes(String[])
public void setStates(String[] pStates)
Expression
setStates
in interface Expression
pStates
- The states to search for.public String[] getStates()
Expression
getStates
in interface Expression
Expression.setStates(String[])
public void setLive(boolean pLive)
Expression
true
expired and not yet
activated articles are not returned by the search. If set to false
all time
controlled articles will be included in the result.
Defaults to false
.setLive
in interface Expression
pLive
- Set to true
to limit the search to live articles.public boolean isLive()
Expression
isLive
in interface Expression
Expression.setLive(boolean)
public void setDescendingSort(boolean pDescending)
Expression
false
(ascending order).setDescendingSort
in interface Expression
pDescending
- Set to true to specify descending sort order.public boolean isDescendingSort()
Expression
isDescendingSort
in interface Expression
Expression.setDescendingSort(boolean)
public Object getParameter(String pName)
Expression
getParameter
in interface Expression
pName
- the parameter nameExpression.setParameter(String, Object)
public final void setParameter(String pName, Object pValue)
Expression
setParameter
in interface Expression
pName
- the parameter namepValue
- the parameter value© 1998- 2018 Stibo DX