Package io.goobi.viewer.model.search
Class SearchQueryItem
java.lang.Object
io.goobi.viewer.model.search.SearchQueryItem
- All Implemented Interfaces:
Serializable
Field/operator/value tuple for the advanced search.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumEnumerates the logical operators (AND, OR, NOT) available for combining values within a single search query item. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanaddNewLine(int afterIndex) booleangenerateQuery(Set<String> searchTerms, boolean aggregateHits, boolean allowFuzzySearch) Generates the advanced query part for this item.getAvailableOperators.getCheckboxSelectables(String language, String... additionalValues) intgetField()Getter for the fieldfield.getLabel()getLines()Convenience getter.intgetSelectItems(String language) getSelectItems.getValue()Backwards compatibility getter.Backwards compatibility method.inthashCode()booleanbooleanbooleanbooleanisDisplayAddNewItemButton(int lineIndex) booleanisDisplaySelectItems.booleanisFirstLine(int lineIndex) booleanisHierarchical.booleanisLastLine(int lineIndex) booleanisRange()isRange.booleanisUntokenizeForPhraseSearch.booleanisValueSet(String value) Backwards compatibility method.booleanremoveLine.voidreset()reset.voidThis is called aftersetField, so no point in callingtoggleDisplaySelectItemshere.voidsetDisplaySelectItems(boolean displaySelectItems) Setter for unit tets.voidSetter for the fieldfield.voidConvenience setter.voidsetPreselectValue(String preselectValue) voidBackwards compatibility setter.voidBackwards compatibility method.protected voidtoggleDisplaySelectItems.voidtoggleValue(String value) Backwards compatibility method.
-
Constructor Details
-
SearchQueryItem
public SearchQueryItem()Zero-argument constructor. -
SearchQueryItem
- Parameters:
template- advanced search template name for field configuration lookup
-
-
Method Details
-
hashCode
public int hashCode() -
equals
-
getAvailableOperators
getAvailableOperators.- Returns:
- a list of search item operators available for this query item (AND, OR, NOT)
-
getSelectItems
public List<StringPair> getSelectItems(String language) throws PresentationException, IndexUnreachableException, DAOException getSelectItems.- Parameters:
language- locale language code for label translation.- Returns:
- a list of label-value pairs for the select dropdown of this query item's field
- Throws:
PresentationException- if any.IndexUnreachableException- if any.DAOException- if any.
-
getCheckboxSelectables
public List<CheckboxSelectable<String>> getCheckboxSelectables(String language, String... additionalValues) throws DAOException, PresentationException, IndexUnreachableException - Parameters:
language- locale language code for label translationadditionalValues- 0-n additional, manually added values- Returns:
- List<CheckboxSelectable<String>>
- Throws:
DAOExceptionPresentationExceptionIndexUnreachableException
-
reset
public void reset()reset. -
isDisplayAddNewItemButton
public boolean isDisplayAddNewItemButton(int lineIndex) - Parameters:
lineIndex- zero-based index of the line to check- Returns:
- true if multiple items are allowed and the given line is the last one, false otherwise
-
isFirstLine
public boolean isFirstLine(int lineIndex) - Parameters:
lineIndex- zero-based index of the line to check- Returns:
- true if given line is first in list; false otherwise
-
isLastLine
public boolean isLastLine(int lineIndex) - Parameters:
lineIndex- zero-based index of the line to check- Returns:
- true if given line is last in list; false otherwise
-
addNewLine
public boolean addNewLine(int afterIndex) - Parameters:
afterIndex- index after which to insert the new line; -1 to append- Returns:
- true if new line successfully added; false otherwise
-
removeLine
removeLine.- Parameters:
line- query item line to remove from this item.- Returns:
- true if the line was removed successfully, false if it could not be removed (e.g. it is the last remaining line)
-
isHierarchical
public boolean isHierarchical()isHierarchical.- Returns:
- true or false
-
isRange
public boolean isRange()isRange.- Returns:
- true or false
-
isDatepicker
public boolean isDatepicker()- Returns:
- true if datepicker should be used for this field's range inputs
-
isUntokenizeForPhraseSearch
public boolean isUntokenizeForPhraseSearch()isUntokenizeForPhraseSearch.- Returns:
- true or false
-
isAllowMultipleItems
public boolean isAllowMultipleItems()- Returns:
- true if multiple search values are allowed for this query item, false otherwise
-
isAllFields
public boolean isAllFields()- Returns:
- true if selected field is "all fields"; false otherwise
-
getDisplaySelectItemsThreshold
public int getDisplaySelectItemsThreshold()- Returns:
- Configured threshold for displayed select items
-
getSelectType
-
getReplaceRegex
-
getReplaceWith
-
getLabel
- Returns:
- the display label for this search query item, or the field name if no label is set
-
setLabel
- Parameters:
label- the display label for this search query item- Returns:
- this
-
getField
Getter for the fieldfield.- Returns:
- the Solr field name to search in for this query item
-
setField
Setter for the fieldfield.- Parameters:
field- the Solr field name to search in for this query item
-
getLines
-
getOperator
Convenience getter.- Returns:
- Operator of the first line
-
setOperator
Convenience setter.- Parameters:
operator- operator to set on the first line
-
getValue
Backwards compatibility getter.- Returns:
- the search value of the first query line, or null if no lines exist
-
setValue
Backwards compatibility setter.- Parameters:
value- the search value to set on the first query line
-
isValueSet
Backwards compatibility method.- Parameters:
value- value to look up in the first line's values list- Returns:
- true if values contains given value; false otherwise
-
toggleValue
Backwards compatibility method.- Parameters:
value- Value to set/unset
-
getValue2
Backwards compatibility method.- Returns:
- the upper bound value of the first query line for range searches, or null if no lines exist
-
setValue2
Backwards compatibility method.- Parameters:
value2- the upper bound value to set on the first query line (used for range searches)
-
isDisplaySelectItems
public boolean isDisplaySelectItems()isDisplaySelectItems.- Returns:
- true if the field should display a select list instead of a free-text input, false otherwise
-
setDisplaySelectItems
public void setDisplaySelectItems(boolean displaySelectItems) Setter for unit tets.- Parameters:
displaySelectItems- true if the field should show a select list instead of a free-text input; false otherwise
-
selectOneMenuListener
This is called aftersetField, so no point in callingtoggleDisplaySelectItemshere.- Parameters:
ev- JSF value change event from the field selector.
-
toggleDisplaySelectItems
protected void toggleDisplaySelectItems()toggleDisplaySelectItems. -
generateQuery
public String generateQuery(Set<String> searchTerms, boolean aggregateHits, boolean allowFuzzySearch) Generates the advanced query part for this item.- Parameters:
searchTerms- set collecting all search terms encountered during query building.aggregateHits- if true, SUPER fields are included for aggregated hit results.allowFuzzySearch- If true, search terms will be augmented by fuzzy search tokens- Returns:
- the Solr query string generated from this advanced search query item
-
getProximitySearchDistance
public int getProximitySearchDistance() -
getPreselectValue
-
setPreselectValue
-