Class SearchBean
- All Implemented Interfaces:
SearchInterface,Serializable
@PostConstruct init() which resets the
advanced search parameters to their defaults.
Lifecycle: Created once per HTTP session by the CDI container; survives across multiple page navigations within the same session and is destroyed when the session expires.
Thread safety: Mostly confined to the JSF request thread of the owning session.
The async Excel-export download state (downloadReady, downloadComplete) is
held in volatile fields and guarded by a synchronized block to allow safe
hand-off between the JSF thread and the background download thread.
- See Also:
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionautocomplete(String suggest) Returns suggestions for autocomplete.Action to execute to change the sort order of hits.voidclearSearchItemLists.executeSavedSearchAction(Search search) executeSavedSearchAction.voidexecuteSearch.voidexecuteSearch(String filterQuery) executeSearch.exportSearchAsExcelAction.exportSearchAsRisAction.facetifyField(String fieldName) facetifyField.voidfindCurrentHitIndex(String pi, int page, boolean aggregateHits) Returns the index of the currently displayed BrowseElement, if it is present in the search hit list.getActiveContext.getActiveResultGroupName.intGet the currently active search type.getAdvancedSearchAllowedFields.static List<AdvancedSearchFieldConfiguration> getAdvancedSearchAllowedFields(String language, String template, boolean addSearchFilters) Returns index field names allowed for advanced search use.Getter for the fieldadvancedSearchQueryGroup.Getter for the fieldadvancedSearchQueryInfo.getAdvancedSearchSelectItems(String field, String language, boolean hierarchical) Populates the list of advanced search drop-down values for the given field.Returns drop-down items for all collection names.getAllCollections(String language) Returns drop-down items for all collection names.getBookmarkListName.getBookmarkListName.getCombinedFilterQuery.getCombinedFilterQueryEscaped.intGetter for the fieldcurrentHitIndex.intgetCurrentHitIndexDisplay.intReturns the current result list page number.Getter for the fieldcurrentSearch.Returns the current search filter as string.getCurrentSearchUrlPart.Returns the base url of the current search page, without any search parameters.Gets the actual search string.List all currentSearchFacets.getFieldFacetValues(String field, int num) getFieldFacetValues.getFieldFacetValues(String field, int num, String filterQuery) getFieldFacetValues.getFilterQueries.getFinalSolrQuery.getFinalSolrQueryEscaped.voidgetFirstQueryItemValue.intGetter for the fieldhitIndexOperand.longGet total number of hits of the last search.getHitsLocations.getHitsMap.intGetter for the fieldhitsPerPage.Getter for the invisible (empty) search string.intReturns the last result list page number.The url of the viewer page loaded when the last search operation was performed, stored inlastUsedSearchPageor the url of the default search or searchAdvanced page depending on the state of this bean.Returns the next BrowseElement in the hit list relative to the given index.Returns the previous BrowseElement in the hit list relative to the given index.intGetter for the fieldproximitySearchDistance.longgetQueryResultCount(String query) getQueryResultCount.Returns relevant search result groups for search execution.Returns the URL to the RSS feed for the current search.Gets a list of all available search filters.Getter for the fieldsearchSortingOption.getSearchSortingOptions(String language) getSearchSortingOptions.Gets the current search string for display.Wrapper method for Pretty URL mappings (so that the values is never empty).Getter for the fieldsearchTerms.Returns the proper search URL part for the current search type.Returns the search string for the selected sort option.getStaticFacets(String field, String subQuery, Integer resultLimit, Boolean reverseOrder) Returns a list of FilterLink elements for the given field over all documents in the index (optionally filtered by a subquery).getStructElement.longgetTotalNumberOfVolumes.booleanhasGeoLocationHits.voidincreaseCurrentHitIndex.voidinit()init.booleanisDisplayResultGroupNames.isDownloadReady.booleanChecks if a search has been triggered by the user and not yet been reset.booleanisFuzzySearchEnabled.booleanisHitsPerPageSetterCalled.booleanReturns if search is performed only within a DC.booleanisSearchInFacetFieldFlag(String fieldName) Returns if search is performed only within a certain facet field.booleanChecks if a search has been performed and any results are to be excepted (provided the search yielded any).booleanisSearchSavingEnabled.booleanDisplay the geo facet map if there are any hits available with geo coordinates.booleanisSolrIndexReachable.booleanisSortingEnabled.voidMatches the selected collection item in the advanced search to the current value ofcurrentCollection.removeFacetAction(String facetQuery) removeFacetAction.removeRangeFacetAction(String field) removeRangeFacetAction.voidreset()Same asresetSearchAction()without the redirect.voidresetActiveSearchType.protected voidResets search options for the advanced search.voidresetCurrentHitIndex.Resets the current search including all results and search parameters.Action method for the "reset" button in search forms.voidresetSearchFilter.voidResets general search options and type specific options for currently unused types.voidresetSearchParameters(boolean resetAllSearchTypes) resetSearchParameters.voidresetSearchParameters(boolean resetAllSearchTypes, boolean resetCurrentPage) Resets general search options and type specific options for currently unused types (all options ifis true). voidResets variables that hold search result data.protected voidResets search options for the simple search.saveSearchAction.search()Dummy method for component cross-compatibility with CMS searches.Executes the search using already set parameters.Perform an advanced Search.searchAdvanced(boolean resetParameters) searchAdvanced.Searches using currently set search string.searchInField(String queryField) Executes an advanced search using the given field.searchInRecord(String piField, String piValue) searchInRecord.searchInRecord(String piField, String piValue, String date1, String date2) searchInRecord.Perform a simple Search.searchSimple(boolean resetParameters) Action method for search buttons (simple search) with an option to reset search parameters.searchSimple(boolean resetParameters, boolean resetFacets) Action method for search buttons (simple search) with an option to reset search parameters and active facets.Same assearchSimple()but resets the current facets.searchSimpleSetFacets(String facetString) Same asbut sets the current facets to the given string.searchSimple()Executes a search for any content tagged with today's month and day.voidsetActiveContext(String activeContext) Depending on configuration settings, sets the given value as the active search result group name and/or active advanced search template.voidsetActiveResultGroup(SearchResultGroup activeResultGroup) Setter for the fieldactiveResultGroup.voidsetActiveResultGroupName(String activeResultGroupName) Sets activeResultGroup via the given name.voidsetActiveSearchType(int activeSearchType) Set the search type to use.voidsetAdvancedQueryItemsReset(boolean reset) "Setter" for resetting the query item list via a f:setPropertyActionListener.voidsetAdvancedSearchFieldTemplate(String advancedSearchFieldTemplate) voidsetBookmarkListName(String name) setBookmarkListName.voidsetBookmarkListName.voidsetCurrentPage(int currentPage) Setter for the fieldcurrentPage.voidsetCurrentSearch(Search currentSearch) Setter for the fieldcurrentSearch.voidsetCurrentSearchFilterString(String searchFilterLabel) Sets the current search filter as string.voidsetExactSearchString(String inSearchString) Sets the currentsearchStringInternalto the given query, without parsing it like the regular setSearchString() method.voidsetFilterQuery(String filterQuery) voidsetFirstQueryItemValue(String value) setFirstQueryItemValue.voidsetFuzzySearchEnabled(boolean fuzzySearchEnabled) Setter for the fieldfuzzySearchEnabled.voidsetHitIndexOperand(int hitIndexOperand) Setter for the fieldhitIndexOperand.voidsetHitsCount(long hitsCount) setHitsCount.voidsetHitsPerPage(int hitsPerPage) Setter for the fieldhitsPerPage.voidsetHitsPerPageNoTrigger(int hitsPerPage) Like setHitsPerPage() but doesn't trigger the boolean.voidsetHitsPerPageSetterCalled(boolean hitsPerPageSetterCalled) Setter for the fieldhitsPerPageSetterCalled.voidsetInvisibleSearchString(String invisibleSearchString) The setter for the invisible search string.voidSet the currentViewerPathas thelastUsedSearchPage.voidsetNavigationHelper(NavigationHelper navigationHelper) Required setter for ManagedProperty injection for unit tests.voidsetSearchSortingOption(SearchSortingOption searchSortingOption) Setter for the fieldsearchSortingOption.voidsetSearchString(String searchString) Sets the actual search string.voidsetSearchStringForUrl(String searchString) Wrapper method for Pretty URL mappings.voidsetSortString(String sortString) Sets the sorting search string.static voidshutdown()Shuts down the static executor.simpleSearch(SearchInterface search) simpleSearch.voidupdateFacetItem(String field, boolean hierarchical) updateFacetItem.
-
Field Details
-
URL_ENCODING
ConstantURL_ENCODING="UTF8".- See Also:
-
-
Constructor Details
-
SearchBean
public SearchBean()Empty constructor.
-
-
Method Details
-
shutdown
public static void shutdown()Shuts down the static executor. Should be called from the servlet context listener on undeploy. -
init
init. -
clearSearchItemLists
public void clearSearchItemLists()clearSearchItemLists. -
search
public String search() throws PresentationException, IndexUnreachableException, DAOException, ViewerConfigurationExceptionDummy method for component cross-compatibility with CMS searches.- Returns:
- Navigation outcome
- Throws:
PresentationExceptionIndexUnreachableExceptionDAOExceptionViewerConfigurationException
-
getEffectiveFilterQuery
-
search
public String search(String filterQuery) throws PresentationException, IndexUnreachableException, DAOException, ViewerConfigurationException Executes the search using already set parameters. Usually called from Pretty URLs.- Parameters:
filterQuery- additional Solr filter query to restrict results- Returns:
- Navigation outcome
- Throws:
PresentationException- if any.IndexUnreachableException- if any.DAOException- if any.ViewerConfigurationException- if any.
-
searchSimple
Perform a simple Search.Action method for search buttons (simple search).
- Specified by:
searchSimplein interfaceSearchInterface- Returns:
- the url to navigate to, or an empty string if naviation is handled internally
-
searchSimple
Action method for search buttons (simple search) with an option to reset search parameters.- Parameters:
resetParameters- true to reset sort, filter and page before searching- Returns:
- Navigation outcome
-
searchSimple
Action method for search buttons (simple search) with an option to reset search parameters and active facets.- Parameters:
resetParameters- true to reset sort, filter and page before searchingresetFacets- true to clear all active facet selections- Returns:
- Navigation outcome
-
simpleSearch
simpleSearch.- Parameters:
search- search interface to trigger simple search on- Returns:
- Navigation outcome
-
searchSimpleResetCollections
Same assearchSimple()but resets the current facets.- Returns:
- Navigation outcome
-
searchSimpleSetFacets
Same asbut sets the current facets to the given string.searchSimple()- Parameters:
facetString- encoded facet selection string to apply before searching- Returns:
- Navigation outcome
-
searchAdvanced
Perform an advanced Search.- Specified by:
searchAdvancedin interfaceSearchInterface- Returns:
- the url to navigate to, or an empty string if naviation is handled internally
-
searchAdvanced
searchAdvanced.- Parameters:
resetParameters- true to reset sort, filter and page before searching- Returns:
- Navigation outcome
-
searchDirect
Searches using currently set search string.- Returns:
- Navigation outcome
-
searchToday
Executes a search for any content tagged with today's month and day.- Returns:
- Navigation outcome
-
resetSearchAction
Action method for the "reset" button in search forms.- Returns:
- Navigation outcome
-
reset
public void reset()Same asresetSearchAction()without the redirect. -
resetSearch
Resets the current search including all results and search parameters.Alias for
resetSearchAction()- Specified by:
resetSearchin interfaceSearchInterface- Returns:
- the url to navigate to, or an empty string if naviation is handled internally
-
resetSearchResults
public void resetSearchResults()Resets variables that hold search result data. Does not reset search parameter variables such as type, filter or collection. -
resetSearchParameters
public void resetSearchParameters()Resets general search options and type specific options for currently unused types. -
resetSearchParameters
public void resetSearchParameters(boolean resetAllSearchTypes) resetSearchParameters.- Parameters:
resetAllSearchTypes- true to also reset parameters for the currently active search type
-
resetSearchParameters
public void resetSearchParameters(boolean resetAllSearchTypes, boolean resetCurrentPage) Resets general search options and type specific options for currently unused types (all options ifis true). - Parameters:
resetAllSearchTypes- If true, parameters for the currently used search type are also reset.resetCurrentPage- If true, currentPage will be reset to 1
-
resetSimpleSearchParameters
protected void resetSimpleSearchParameters()Resets search options for the simple search. -
resetAdvancedSearchParameters
protected void resetAdvancedSearchParameters()Resets search options for the advanced search. -
setAdvancedQueryItemsReset
public void setAdvancedQueryItemsReset(boolean reset) "Setter" for resetting the query item list via a f:setPropertyActionListener.- Parameters:
reset- true to reset advanced search query items to defaults
-
executeSearch
public void executeSearch() throws PresentationException, IndexUnreachableException, DAOException, ViewerConfigurationExceptionexecuteSearch.- Throws:
PresentationException- if any.IndexUnreachableException- if any.DAOException- if any.ViewerConfigurationException- if any.
-
executeSearch
public void executeSearch(String filterQuery) throws PresentationException, IndexUnreachableException, DAOException, ViewerConfigurationException executeSearch.- Parameters:
filterQuery- additional Solr filter query to restrict results- Throws:
PresentationException- if any.IndexUnreachableException- if any.DAOException- if any.ViewerConfigurationException- if any.
-
setLastUsedSearchPage
public void setLastUsedSearchPage()Set the currentViewerPathas thelastUsedSearchPage. This is where returning to search hit list from record will direct to -
getFinalSolrQuery
getFinalSolrQuery.- Returns:
- the final Solr query string generated from the current or an empty search
-
getFilterQueries
getFilterQueries.- Returns:
- a list of active Solr filter query strings from the current search and active facets
-
getCombinedFilterQuery
getCombinedFilterQuery.- Returns:
- Generated query
-
getActiveSearchType
public int getActiveSearchType()Get the currently active search type. The possible types are defined inSearchHelper- Specified by:
getActiveSearchTypein interfaceSearchInterface- Returns:
- the active search type
-
getAdvancedSearchOrigin
- Returns:
- the origin record from which the search was triggered, or null
-
setActiveSearchType
public void setActiveSearchType(int activeSearchType) Set the search type to use. The possible types are defined inSearchHelper- Specified by:
setActiveSearchTypein interfaceSearchInterface- Parameters:
activeSearchType- search type constant as defined in SearchHelper
-
resetActiveSearchType
public void resetActiveSearchType()resetActiveSearchType. -
autocomplete
Returns suggestions for autocomplete.- Specified by:
autocompletein interfaceSearchInterface- Parameters:
suggest- partial input string to complete- Returns:
- suggestions for autocomplete
- Throws:
IndexUnreachableException- if any.
-
isSearchInDcFlag
public boolean isSearchInDcFlag()Returns if search is performed only within a DC.- Specified by:
isSearchInDcFlagin interfaceSearchInterface- Returns:
- true if the search is restricted to a specific DC (collection) field, false otherwise
-
isSearchInFacetFieldFlag
Returns if search is performed only within a certain facet field.- Specified by:
isSearchInFacetFieldFlagin interfaceSearchInterface- Parameters:
fieldName- Solr facet field name to check- Returns:
- true if the search is restricted to the given facet field, false otherwise
-
getInvisibleSearchString
Getter for the invisible (empty) search string. Used for the search field widget for when no search input display is desired.- Returns:
- empty string
-
setInvisibleSearchString
The setter for the invisible search string. Performs all regular settings.- Parameters:
invisibleSearchString- search string value to apply silently
-
getSearchString
Gets the current search string for display.- Specified by:
getSearchStringin interfaceSearchInterface- Returns:
- the current search string for display
-
getSearchStringForUrl
Wrapper method for Pretty URL mappings (so that the values is never empty).- Returns:
- the current search query string sanitized for use in a Pretty URL, or "-" if blank
-
setSearchStringForUrl
Wrapper method for Pretty URL mappings.- Parameters:
searchString- URL-decoded search string from the Pretty URL
-
setSearchString
Sets the actual search string.Wrapper for setSearchStringKeepCurrentPage() that also resets
currentPage.- Specified by:
setSearchStringin interfaceSearchInterface- Parameters:
searchString- raw search query to set
-
getExactSearchString
Gets the actual search string.- Specified by:
getExactSearchStringin interfaceSearchInterface- Returns:
- the actual search string
-
setExactSearchString
Sets the currentsearchStringInternalto the given query, without parsing it like the regular setSearchString() method. This method performs URL-unescaping, so using it directly with unescaped queries containing '+' etc. will change the logic.- Parameters:
inSearchString- URL-encoded Solr query string from the Pretty URL
-
setSortString
Sets the sorting search string.- Specified by:
setSortStringin interfaceSearchInterface- Parameters:
sortString- sort field and direction encoded as search string
-
getSortString
Returns the search string for the selected sort option.- Specified by:
getSortStringin interfaceSearchInterface- Returns:
- the search string for the selected sort option
-
getSearchSortingOption
Getter for the fieldsearchSortingOption.- Returns:
- the currently active sort option applied to search results
-
setSearchSortingOption
Setter for the fieldsearchSortingOption.- Parameters:
searchSortingOption- the sort option to apply to the current search results
-
getResultGroupsForSearchExecution
Returns relevant search result groups for search execution. If an active group is set, return just that. Otherwise, return either all configured groups or default group (if groups disabled).- Returns:
- Relevant search result groups
-
isDisplayResultGroupNames
public boolean isDisplayResultGroupNames()isDisplayResultGroupNames.- Returns:
- true if activeResultGroup null; false otherwise
-
getActiveContext
getActiveContext.- Specified by:
getActiveContextin interfaceSearchInterface- Returns:
- activeResultGroup name; "-" if none set
-
setActiveResultGroup
Setter for the fieldactiveResultGroup.- Parameters:
activeResultGroup- search result group to activate, or null to deactivate
-
setActiveContext
Depending on configuration settings, sets the given value as the active search result group name and/or active advanced search template.- Specified by:
setActiveContextin interfaceSearchInterface- Parameters:
activeContext- Name of the active context
-
getActiveResultGroupName
getActiveResultGroupName. For URL building, use getActiveContext() instead.- Returns:
- activeResultGroup name; "-" if none set
-
setActiveResultGroupName
Sets activeResultGroup via the given name.- Parameters:
activeResultGroupName- Name of the active context
-
getAdvancedSearchFieldTemplate
-
setAdvancedSearchFieldTemplate
- Parameters:
advancedSearchFieldTemplate- Template name for advanced search fields
-
mirrorAdvancedSearchCurrentHierarchicalFacets
public void mirrorAdvancedSearchCurrentHierarchicalFacets()Matches the selected collection item in the advanced search to the current value ofcurrentCollection. -
removeRangeFacetAction
removeRangeFacetAction.- Parameters:
field- Solr field name of the range facet to remove- Returns:
- Navigation outcome
-
removeFacetAction
removeFacetAction.- Parameters:
facetQuery- encoded facet query string identifying the facet to remove- Returns:
- Navigation outcome
-
getCurrentPage
public int getCurrentPage()Returns the current result list page number.- Specified by:
getCurrentPagein interfaceSearchInterface- Returns:
- the current result list page number
-
setCurrentPage
public void setCurrentPage(int currentPage) Setter for the fieldcurrentPage.- Parameters:
currentPage- the 1-based page number to navigate to in the search results
-
getHitsCount
public long getHitsCount()Get total number of hits of the last search.- Specified by:
getHitsCountin interfaceSearchInterface- Returns:
- the total number of hits of the last search
-
setHitsCount
public void setHitsCount(long hitsCount) setHitsCount.- Parameters:
hitsCount- the total number of search hits to store on the current search
-
getSearchTerms
Getter for the fieldsearchTerms.- Returns:
- map of Solr field names to the set of search terms entered for each field
-
getCurrentHitIndex
public int getCurrentHitIndex()Getter for the fieldcurrentHitIndex.- Returns:
- the zero-based index of the currently displayed search hit
-
getCurrentHitIndexDisplay
public int getCurrentHitIndexDisplay()getCurrentHitIndexDisplay.- Returns:
- a int.
-
increaseCurrentHitIndex
public void increaseCurrentHitIndex()increaseCurrentHitIndex. -
getHitIndexOperand
public int getHitIndexOperand()Getter for the fieldhitIndexOperand.- Returns:
- the operand used to calculate the next or previous hit index when navigating between hits
-
setHitIndexOperand
public void setHitIndexOperand(int hitIndexOperand) Setter for the fieldhitIndexOperand.- Parameters:
hitIndexOperand- the operand used to calculate the next or previous hit index to navigate to
-
findCurrentHitIndex
Returns the index of the currently displayed BrowseElement, if it is present in the search hit list.- Parameters:
pi- Record identifier of the loaded record.page- Page number of he loaded record.aggregateHits- If true, only the identifier has to match, page number is ignored.
-
getNextElement
public BrowseElement getNextElement() throws PresentationException, IndexUnreachableException, DAOException, ViewerConfigurationExceptionReturns the next BrowseElement in the hit list relative to the given index.- Returns:
- Next BrowseElement in the list; same BrowseElement if this is the last index in the list; null if search is not initialized
- Throws:
PresentationException- if any.IndexUnreachableException- if any.DAOException- if any.ViewerConfigurationException- if any.
-
getPreviousElement
public BrowseElement getPreviousElement() throws PresentationException, IndexUnreachableException, DAOException, ViewerConfigurationExceptionReturns the previous BrowseElement in the hit list relative to the given index.- Returns:
- Previous BrowseElement in the list; same BrowseElement if this is the first index in the list; null if search is not initialized
- Throws:
PresentationException- if any.IndexUnreachableException- if any.DAOException- if any.ViewerConfigurationException- if any.
-
getSearchFilters
Gets a list of all available search filters.- Specified by:
getSearchFiltersin interfaceSearchInterface- Returns:
- a list of all available search filters
-
getCurrentSearchFilterString
Returns the current search filter as string.- Specified by:
getCurrentSearchFilterStringin interfaceSearchInterface- Returns:
- the current search filter as string
-
setCurrentSearchFilterString
Sets the current search filter as string.Sets
currentSearchFiltervia the given label value.- Specified by:
setCurrentSearchFilterStringin interfaceSearchInterface- Parameters:
searchFilterLabel- search filter identifier string to activate
-
resetSearchFilter
public void resetSearchFilter()resetSearchFilter. -
resetCurrentHitIndex
public void resetCurrentHitIndex()resetCurrentHitIndex. -
isSortingEnabled
public boolean isSortingEnabled()isSortingEnabled.- Returns:
- true if search result sorting is enabled in the configuration, false otherwise
-
getAdvancedSearchQueryGroup
Getter for the fieldadvancedSearchQueryGroup.- Returns:
- the root query group containing all advanced search field conditions
-
getAdvancedSearchSelectItems
public List<StringPair> getAdvancedSearchSelectItems(String field, String language, boolean hierarchical) throws PresentationException, IndexUnreachableException, DAOException Populates the list of advanced search drop-down values for the given field. List is only generated once per user session.- Parameters:
field- The index field for which to get drop-down values.language- Translation language for the values.hierarchical- If true, the menu items will be listed in their corresponding hierarchy (e.g. DC)- Returns:
- a list of label/value pairs for use in advanced search drop-down menus for the given field
- Throws:
PresentationException- if any.IndexUnreachableException- if any.DAOException- if any.
-
getAllCollections
Returns drop-down items for all collection names. Convenience method that retrieves the current language fromNavigationHelper.This method shouldn't throw exceptions, otherwise it can cause an IllegalStateException.
- Returns:
- a list of label/value pairs for all available collection names in the current user's language
-
getAllCollections
public List<StringPair> getAllCollections(String language) throws PresentationException, IndexUnreachableException, DAOException Returns drop-down items for all collection names. The displayed values are translated into the given language.- Parameters:
language- BCP 47 language tag for translating collection labels- Returns:
- a list of label/value pairs for all available collection names translated into the given language
- Throws:
PresentationException- if any.IndexUnreachableException- if any.DAOException- if any.
-
getAdvancedSearchAllowedFields
getAdvancedSearchAllowedFields.- Returns:
- List of allowed advanced search fields
-
getAdvancedSearchFirstItemAllowedFields
-
getAdvancedSearchAllowedFields
public static List<AdvancedSearchFieldConfiguration> getAdvancedSearchAllowedFields(String language, String template, boolean addSearchFilters) Returns index field names allowed for advanced search use. If language-specific index fields are used, those that don't match the current locale are omitted.- Parameters:
language- Optional language code for filtering language-specific fieldstemplate- advanced search field configuration template nameaddSearchFilters- If true, prepend configured search filters as fields- Returns:
- List of allowed advanced search fields
-
getCurrentSearch
Getter for the fieldcurrentSearch.- Returns:
- the Search object representing the active search query and its results
-
setCurrentSearch
Setter for the fieldcurrentSearch.- Parameters:
currentSearch- the Search object representing the active search query and its results
-
isFuzzySearchEnabled
public boolean isFuzzySearchEnabled()isFuzzySearchEnabled.- Returns:
- true if fuzzy matching is enabled for search queries, false otherwise
-
setFuzzySearchEnabled
public void setFuzzySearchEnabled(boolean fuzzySearchEnabled) Setter for the fieldfuzzySearchEnabled.- Parameters:
fuzzySearchEnabled- true to enable fuzzy matching in search queries, false for exact matching
-
saveSearchAction
saveSearchAction.- Returns:
- the empty navigation outcome string after persisting the current search
- Throws:
DAOException- if any.
-
getRssUrl
Returns the URL to the RSS feed for the current search.- Returns:
- RSS feed URL, or null if no search string is set
- Throws:
ViewerConfigurationException- if any.
-
isSearchSavingEnabled
public boolean isSearchSavingEnabled()isSearchSavingEnabled.- Returns:
- true if saving searches is enabled in the configuration, false otherwise
-
executeSavedSearchAction
executeSavedSearchAction.- Parameters:
search- previously saved search object to re-execute- Returns:
- the navigation outcome string after restoring and executing the saved search, or null if the redirect URL cannot be built
-
exportSearchAsRisAction
exportSearchAsRisAction.- Returns:
- the empty navigation outcome string after writing the RIS export to the HTTP response
- Throws:
IndexUnreachableException- if any.
-
exportSearchAsExcelAction
exportSearchAsExcelAction.- Returns:
- an empty string after initiating the Excel export response
- Throws:
IndexUnreachableException- if any.
-
getHitsPerPage
public int getHitsPerPage()Getter for the fieldhitsPerPage.- Returns:
- the number of search results displayed per page
-
setHitsPerPage
public void setHitsPerPage(int hitsPerPage) Setter for the fieldhitsPerPage.- Parameters:
hitsPerPage- the number of search results to display per page
-
setHitsPerPageNoTrigger
public void setHitsPerPageNoTrigger(int hitsPerPage) Like setHitsPerPage() but doesn't trigger the boolean.- Parameters:
hitsPerPage- the number of search results to display per page
-
isHitsPerPageSetterCalled
public boolean isHitsPerPageSetterCalled()isHitsPerPageSetterCalled.- Returns:
- true if the hits-per-page setter has been explicitly invoked during the current request, false otherwise
-
setHitsPerPageSetterCalled
public void setHitsPerPageSetterCalled(boolean hitsPerPageSetterCalled) Setter for the fieldhitsPerPageSetterCalled.- Parameters:
hitsPerPageSetterCalled- true if the hits-per-page setter has been explicitly invoked during the current request
-
getAdvancedSearchQueryInfo
Getter for the fieldadvancedSearchQueryInfo.- Returns:
- the HTML-escaped human-readable description of the current advanced search query
-
getFacets
List all currentSearchFacets.- Specified by:
getFacetsin interfaceSearchInterface- Returns:
- all current
SearchFacets
-
isDownloadReady
isDownloadReady.- Returns:
- a Future resolving to true when the export download is ready
-
getTotalNumberOfVolumes
getTotalNumberOfVolumes.- Returns:
- a long.
- Throws:
IndexUnreachableException- if any.PresentationException- if any.
-
getSearchUrl
Returns the proper search URL part for the current search type.- Returns:
- the URL for the search page matching the currently active search type
-
getLastPage
public int getLastPage()Returns the last result list page number.- Specified by:
getLastPagein interfaceSearchInterface- Returns:
- the last result list page number
-
getStructElement
public StructElement getStructElement(String pi) throws IndexUnreachableException, PresentationException getStructElement.- Parameters:
pi- persistent identifier of the record- Returns:
- the top-level StructElement for the record with the given PI
- Throws:
IndexUnreachableException- if any.PresentationException- if any.
-
getCurrentSearchUrlRoot
Returns the base url of the current search page, without any search parameters.- Specified by:
getCurrentSearchUrlRootin interfaceSearchInterface- Returns:
- the base url of the current search page, without any search parameters
-
getCurrentSearchUrlPart
getCurrentSearchUrlPart.- Returns:
- Parameter string for pretty:search5 URLs.
-
updateFacetItem
updateFacetItem.- Parameters:
field- Solr field name of the facet to updatehierarchical- true if the field uses hierarchical faceting
-
getStaticFacets
public List<IFacetItem> getStaticFacets(String field, String subQuery, Integer resultLimit, Boolean reverseOrder) throws PresentationException, IndexUnreachableException Returns a list of FilterLink elements for the given field over all documents in the index (optionally filtered by a subquery). Replaces the method in the old TagLib class.- Parameters:
field- Solr field name to retrieve facet values forsubQuery- optional Solr sub-query to filter the facet base setresultLimit- maximum number of facet values to returnreverseOrder- true to sort facet values in reverse order- Returns:
- a list of facet items for the given field over all indexed documents, optionally filtered by the sub-query
- Throws:
PresentationException- if any.IndexUnreachableException- if any.
-
isSearchPerformed
public boolean isSearchPerformed()Checks if a search has been performed and any results are to be excepted (provided the search yielded any).- Specified by:
isSearchPerformedin interfaceSearchInterface- Returns:
- whether a search has been performed after the last reset
-
isExplicitSearchPerformed
public boolean isExplicitSearchPerformed()Checks if a search has been triggered by the user and not yet been reset.- Specified by:
isExplicitSearchPerformedin interfaceSearchInterface- Returns:
- if a search has been triggered by the user and not yet been reset
-
setFirstQueryItemValue
setFirstQueryItemValue.- Parameters:
value- search term to set on the first advanced query item
-
getFirstQueryItemValue
public void getFirstQueryItemValue()getFirstQueryItemValue. -
setBookmarkListName
setBookmarkListName.- Parameters:
name- bookmark list name to set as advanced search query value
-
getBookmarkListName
getBookmarkListName.- Returns:
- name of the bookmark list set in the advanced search query
-
getProximitySearchDistance
public int getProximitySearchDistance()Getter for the fieldproximitySearchDistance.- Returns:
- a int
-
searchInRecord
searchInRecord.- Parameters:
piField- Solr field name holding the record identifierpiValue- persistent identifier value to restrict the search to- Returns:
- Navigation outcome
-
searchInRecord
searchInRecord.- Parameters:
piField- Solr field name holding the record identifierpiValue- persistent identifier value to restrict the search todate1- Start date for the calendar day range filterdate2- End date for the calendar day range filter- Returns:
- Navigation outcome
-
searchInField
Executes an advanced search using the given field. The search value is set via the HTML component using this method.- Parameters:
queryField- Advanced search field to query- Returns:
- Navigation outcome
-
isSolrIndexReachable
public boolean isSolrIndexReachable()isSolrIndexReachable.- Returns:
- true if Solr ping successful; false otherwise
-
hasGeoLocationHits
public boolean hasGeoLocationHits()hasGeoLocationHits.- Specified by:
hasGeoLocationHitsin interfaceSearchInterface- Returns:
- true if the current search results contain records with geo-location data, false otherwise
-
getHitsLocations
getHitsLocations.- Returns:
- a list of GeoJSON strings for each search hit that has geographic coordinates
-
isShowGeoFacetMap
public boolean isShowGeoFacetMap()Display the geo facet map if there are any hits available with geo coordinates.- Returns:
- true if search hits with coordinates available; false otherwise
-
getHitsMap
getHitsMap.- Specified by:
getHitsMapin interfaceSearchInterface- Returns:
- a GeoMap populated with the geo-location hits from the current search result
-
facetifyField
facetifyField.- Parameters:
fieldName- Solr field name to convert to its facet variant- Returns:
- Facet variant of the given fieldName
-
getFieldFacetValues
getFieldFacetValues.- Parameters:
field- Solr field name to retrieve facet values fornum- maximum number of facet values to return; 0 for unlimited- Returns:
- List of facet values for the given field
- Throws:
IndexUnreachableException
-
getFieldFacetValues
public List<FacetItem> getFieldFacetValues(String field, int num, String filterQuery) throws IndexUnreachableException getFieldFacetValues.- Parameters:
field- Solr field name to retrieve facet values fornum- maximum number of facet values to return; 0 for unlimitedfilterQuery- additional Solr filter query to restrict the facet base set- Returns:
- List of facet values for the given field
- Throws:
IndexUnreachableException
-
getSearchSortingOptions
getSearchSortingOptions.- Parameters:
language- BCP 47 language tag for translating sort option labels- Returns:
- List of sorting options for the given language
-
getQueryResultCount
public long getQueryResultCount(String query) throws IndexUnreachableException, PresentationException getQueryResultCount.- Parameters:
query- Solr query to count results for- Returns:
- Number of hits for the given query
- Throws:
IndexUnreachableExceptionPresentationException
-
getFinalSolrQueryEscaped
getFinalSolrQueryEscaped.- Returns:
- URL-encoded final query
-
getCombinedFilterQueryEscaped
getCombinedFilterQueryEscaped.- Returns:
- URL-encoded combined filter query
-
getFilterQuery
-
setFilterQuery
-
getLastUsedSearchUrl
The url of the viewer page loaded when the last search operation was performed, stored inlastUsedSearchPageor the url of the default search or searchAdvanced page depending on the state of this bean.- Returns:
- a URL string
-
changeSorting
Action to execute to change the sort order of hits.- Specified by:
changeSortingin interfaceSearchInterface- Returns:
- Navigation outcome
- Throws:
IOException
-
getHttpRequest
-