public interface Expression
Expression
interface stores search parameters for a
specific search. Theses instances may be passed to search implementations,
which in turn will perform the search through its underlying search engine,
after translating the parameters to the search engines native form.
The most important property is "expression"
,
the free text search string.DefaultExpression
,
neo.xredsys.api.ObjectLoader#articleSearch(Expression)
Modifier and Type | Method and Description |
---|---|
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.
|
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.
|
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.
|
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 pSortOrder)
Specifies whether the result should be sorted in descending or ascending order.
|
void |
setExcludedNodes(int[] pNodeIds)
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[] pNodeIds)
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 |
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 pSortField)
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.
|
void setId(int pId)
-1
, meaning all ids.pId
- the idint getId()
setId(int)
void setMaxSearchRows(int pMaxSearchRows)
-1
, meaning all rows will be returned.pMaxSearchRows
- the maximum number of rows (objects) requested by this expression.int getMaxSearchRows()
setMaxSearchRows(int)
void setSearchString(String pExpression)
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"pExpression
- the text to search for.QueryTranslator
String getSearchString()
setSearchString(String)
void setNodes(int[] pNodeIds)
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.pNodeIds
- The ids of theo nodes to search in.int[] getNodes()
setNodes(int[])
void setSearchSubNodes(boolean pInclude)
true
, which means search-sub nodes.pInclude
- If true
this expression will include sub-nodes of all nodes specified.setNodes(int[])
boolean isSearchSubNodes()
setSearchSubNodes(boolean)
void setExcludedNodes(int[] pNodeIds)
null
, which means don't exclude any nodes.pNodeIds
- The ids of the nodes to exclude.setNodes(int[])
int[] getExcludedNodes()
setExcludedNodes(int[])
void setTypes(String[] pTypes)
ReferenceEntity
objects this will be "Image", "Link", "Media" or "Person".
If no types are given, the default is to search for all types.pTypes
- The types to search for, or null
to seach for all typesString[] getTypes()
setTypes(String[])
void setStates(String[] pStates)
pStates
- The states to search for.String[] getStates()
setStates(String[])
void setFromDate(Date pFromDate)
pFromDate
- the first date to include, or null
setToDate(java.util.Date)
Date getFromDate()
setFromDate(java.util.Date)
void setToDate(Date pToDate)
pToDate
- the last date to include, or null
setFromDate(java.util.Date)
Date getToDate()
setToDate(java.util.Date)
void setLive(boolean pLive)
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
.pLive
- Set to true
to limit the search to live articles.boolean isLive()
setLive(boolean)
void setSort(String pSortField)
"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"
.pSortField
- the field to use for sortingString getSort()
setSort(String)
void setDescendingSort(boolean pSortOrder)
false
(ascending order).pSortOrder
- Set to true to specify descending sort order.boolean isDescendingSort()
setDescendingSort(boolean)
void setParameter(String pName, Object pValue)
pName
- the parameter namepValue
- the parameter valueObject getParameter(String pName)
pName
- the parameter namesetParameter(String, Object)
© 1998- 2021 Escenic AS