@SessionScoped @Named public class SearchCommand extends Pazpar2Command implements ServiceProxyCommand
search
command, can be accessed by pzreq.search
Constructor and Description |
---|
SearchCommand() |
Modifier and Type | Method and Description |
---|---|
void |
addFilter(java.lang.String field,
java.lang.String operator,
java.lang.String value,
java.lang.String label)
Adds a filter expression with a label for display.
|
void |
addLimit(java.lang.String field,
java.lang.String operator,
java.lang.String value,
java.lang.String label)
Adds a limit expression with a label for display.
|
void |
addQueryExpression(java.lang.String field,
java.lang.String operator,
java.lang.String term,
java.lang.String label)
Adds an expression - for instance a facet criterion, with an optional label - to the query parameter
|
SearchCommand |
copy()
Commands must implement this method to provide an completely detached, deep clone of
themselves.
|
java.lang.String |
getExtendedQuery()
Returns the complete
query parameter value, including expressions. |
java.lang.String |
getFilter()
Returns the
filter parameter value. |
java.util.List<Expression> |
getFilterExpressions()
Returns list of all filter expressions
|
java.util.List<Expression> |
getFilterExpressions(java.lang.String... expressionFields) |
java.lang.String |
getLimit()
Returns the
limit parameter value. |
java.util.List<Expression> |
getLimitExpressions()
Return a list of all current limit expressions
|
java.util.List<Expression> |
getLimitExpressions(java.lang.String... expressionFields)
Returns a list of limit expressions with fields that matches on of
expressionFields |
java.lang.String |
getMaxrecs()
Returns the
maxrecs parameter value. |
java.lang.String |
getMergekey()
Returns the
mergekey parameter value. |
Expression |
getOneFilterExpression(java.lang.String expressionField)
Returns the first filter expression of the given type
|
Expression |
getOneLimitExpression(java.lang.String expressionField)
Returns the first limit expression of the given type
|
java.lang.String |
getQuery()
Returns the simple part of the
query parameter value, excluding parts that
were added as expressions (that is, not set with setQuery() ). |
java.lang.String |
getRank()
Returns the
rank parameter value. |
java.lang.String |
getSort()
Returns the
sort parameter value. |
ServiceProxyCommand |
getSp()
Implementing classes must provide their Service Proxy
extension command if any extension parameters exists,
or -- just to be polite -- 'this' if there is no
Service Proxy extension to the given command.
|
java.lang.String |
getStartrecs()
Returns the
startrecs parameter value. |
boolean |
hasFilter() |
boolean |
hasFilterExpression(java.lang.String... expressionFields)
Checks if there are any filter expressions matching any of the given expressionFields
|
boolean |
hasLimitExpression(java.lang.String... expressionFields)
Checks if there are any limit expressions matching any of the given expressionFields
|
void |
removeFacet(java.lang.String facetKey,
java.lang.String term)
Removes a facet set by setFacet(...)
Will not remove facets set by setFacetOnQuery(...)
|
void |
removeFilter(java.lang.String field,
java.lang.String operator,
java.lang.String value)
Removes a filter expression by exact attributes
|
void |
removeFilters()
Clears the filter parameter
|
void |
removeFilters(java.lang.String... fieldsToRemove)
Removes all filter expressions matching a field listed in
fieldsToRemove |
void |
removeFiltersAfter(java.lang.String field,
java.lang.String operator,
java.lang.String value,
java.lang.String... fieldsToRemove)
Removes filter expressions coming after the expression matching the provided filter expression,
if they have a field listed in
fieldsToRemove . |
void |
removeLimit(java.lang.String field,
java.lang.String operator,
java.lang.String value)
Removes a limit expression by exact attributes
|
void |
removeLimits()
Clears the limit parameter
|
void |
removeLimits(java.lang.String... fieldsToRemove)
Removes all limit expressions that have fields as listed in
fieldsToRemove |
void |
removeLimitsAfter(java.lang.String field,
java.lang.String operator,
java.lang.String value,
java.lang.String... fieldsToRemove)
Removes limit expressions coming after the provided limit expression, if they have a field listed in
fieldsToRemove . |
void |
removeQueryExpression(java.lang.String field,
java.lang.String operator,
java.lang.String value)
Removes a query expression - for instance a facet criterion - by its exact attributes
|
ResponseDataObject |
run()
Executes the command with the currently selected parameters against
the currently selected Pazpar2 service
|
void |
setBooleanOperatorForQuery(java.lang.String operator) |
void |
setFacetOnQuery(java.lang.String facetKey,
java.lang.String term)
Sets a facet to limit the current query by.
|
void |
setFilter(java.lang.String filterExpression)
Sets the
filter parameter. |
void |
setFilter(java.lang.String field,
java.lang.String operator,
java.lang.String value,
java.lang.String label)
Sets the
filter parameter. |
void |
setLimit(java.lang.String limitExpression)
Sets the
limit parameter. |
void |
setLimit(java.lang.String field,
java.lang.String operator,
java.lang.String value,
java.lang.String label)
Sets the
limit parameter including a label. |
void |
setMaxrecs(java.lang.String maxrecs)
Sets the
maxrecs parameter. |
void |
setMergekey(java.lang.String mergekey)
Sets the
mergekey parameter. |
void |
setQuery(java.lang.String query)
Sets the
query parameter. |
void |
setRank(java.lang.String rank)
Sets the
rank parameter. |
void |
setSort(java.lang.String sort)
Sets the
sort parameter. |
void |
setStartrecs(java.lang.String startrecs)
Sets the
startrecs parameter. |
boolean |
spOnly()
Here implementing commands publish whether they only
apply to the Service Proxy or can be executed
against straight Pazpar2 as well.
|
addExpression, equals, getCommandName, getEncodedQueryString, getParameter, getParameterValue, getSession, getValueWithExpressions, hashCode, hasParameters, hasParameterValue, removeExpression, removeExpressions, removeExpressionsAfter, removeParameter, removeParameters, removeParametersInState, run, runWith, runWith2, setCommandName, setParameter, setParameterInState, setParameters, setParametersInState, setSession, toString
public ResponseDataObject run()
Pazpar2Command
run
in class Pazpar2Command
public void setQuery(java.lang.String query)
query
parameter. See Pazpar2 documentation for details.public void setBooleanOperatorForQuery(java.lang.String operator)
public java.lang.String getQuery()
query
parameter value, excluding parts that
were added as expressions (that is, not set with setQuery()
).public java.lang.String getExtendedQuery()
query
parameter value, including expressions.public void setFilter(java.lang.String filterExpression)
filter
parameter. See Pazpar2 documentation for details.public void setFilter(java.lang.String field, java.lang.String operator, java.lang.String value, java.lang.String label)
filter
parameter. See Pazpar2 documentation for details.public boolean hasFilterExpression(java.lang.String... expressionFields)
expressionFields
- expression fields (left-of-operator entities) to look forexpressionFields
public java.lang.String getFilter()
filter
parameter value.public Expression getOneFilterExpression(java.lang.String expressionField)
expressionField
- expression field (left-of-operator entity) to look forexpressionField
or null if none foundpublic java.util.List<Expression> getFilterExpressions()
public java.util.List<Expression> getFilterExpressions(java.lang.String... expressionFields)
public boolean hasFilter()
public void addFilter(java.lang.String field, java.lang.String operator, java.lang.String value, java.lang.String label)
field
- operator
- value
- label
- public void removeFilters()
public void removeFilter(java.lang.String field, java.lang.String operator, java.lang.String value)
field
- operator
- value
- public void removeFilters(java.lang.String... fieldsToRemove)
fieldsToRemove
fieldsToRemove
- public void removeFiltersAfter(java.lang.String field, java.lang.String operator, java.lang.String value, java.lang.String... fieldsToRemove)
fieldsToRemove
. To be used for bread crumb like UI
controls.field
- operator
- value
- fieldsToRemove
- public void setLimit(java.lang.String limitExpression)
limit
parameter. See Pazpar2 documentation for details.public void setLimit(java.lang.String field, java.lang.String operator, java.lang.String value, java.lang.String label)
limit
parameter including a label. See Pazpar2 documentation for details.public java.lang.String getLimit()
limit
parameter value.public boolean hasLimitExpression(java.lang.String... expressionFields)
expressionFields
- expression fields (left-of-operator entities) to look forexpressionFields
public Expression getOneLimitExpression(java.lang.String expressionField)
expressionField
- expression field (left-of-operator entity) to look forexpressionField
or null if none foundpublic java.util.List<Expression> getLimitExpressions()
public java.util.List<Expression> getLimitExpressions(java.lang.String... expressionFields)
expressionFields
expressionFields
- limit expressions to look forpublic void addLimit(java.lang.String field, java.lang.String operator, java.lang.String value, java.lang.String label)
field
- operator
- value
- label
- public void removeLimits()
public void removeLimits(java.lang.String... fieldsToRemove)
fieldsToRemove
fieldsToRemove
- public void removeLimit(java.lang.String field, java.lang.String operator, java.lang.String value)
field
- operator
- value
- public void removeLimitsAfter(java.lang.String field, java.lang.String operator, java.lang.String value, java.lang.String... fieldsToRemove)
fieldsToRemove
. To be used for bread crumb like UI controls.field
- operator
- value
- fieldsToRemove
- public void setStartrecs(java.lang.String startrecs)
startrecs
parameter. See Pazpar2 documentation for details.public java.lang.String getStartrecs()
startrecs
parameter value.public void setMaxrecs(java.lang.String maxrecs)
maxrecs
parameter. See Pazpar2 documentation for details.public java.lang.String getMaxrecs()
maxrecs
parameter value.public void setSort(java.lang.String sort)
sort
parameter. See Pazpar2 documentation for details.public java.lang.String getSort()
sort
parameter value.public void setRank(java.lang.String rank)
rank
parameter. See Pazpar2 documentation for details.public java.lang.String getRank()
rank
parameter value.public void setMergekey(java.lang.String mergekey)
mergekey
parameter. See Pazpar2 documentation for details.public java.lang.String getMergekey()
mergekey
parameter value.public void addQueryExpression(java.lang.String field, java.lang.String operator, java.lang.String term, java.lang.String label)
Example:
{au}{=}{"Steinbeck, John"}{Steinbeck, John}
public void removeQueryExpression(java.lang.String field, java.lang.String operator, java.lang.String value)
field
- operator
- value
- public void setFacetOnQuery(java.lang.String facetKey, java.lang.String term)
facetKey
- i.e. 'au' for authorterm
- i.e. 'Dickens, Charles'public void removeFacet(java.lang.String facetKey, java.lang.String term)
facetKey
- i.e. 'au' for authorterm
- i.e. 'Dickens, Charles'public SearchCommand copy()
Pazpar2Command
copy
in class Pazpar2Command
public ServiceProxyCommand getSp()
Pazpar2Command
getSp
in class Pazpar2Command
public boolean spOnly()
Pazpar2Command
spOnly
in interface ServiceProxyCommand
spOnly
in class Pazpar2Command