Package org.dspace.discovery
Class SearchUtils
java.lang.Object
org.dspace.discovery.SearchUtils
Util methods used by discovery
- Author:
- Kevin Van de Velde (kevin at atmire dot com), Mark Diggory (markd at atmire dot com), Ben Bosman (ben at atmire dot com)
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic Set<DiscoveryConfiguration>addDiscoveryConfigurationForParents(Context context, Set<DiscoveryConfiguration> configurations, String prefix, DSpaceObject dso) Retrieve the configuration for the current dspace object and all its parents and add it to the provided setstatic voidClear the cachedSearchServiceinstance, forcing it to be retrieved from the service manager again next timegetSearchService()is called.static List<DiscoveryConfiguration>getAllDiscoveryConfigurations(Context context, Item item) Method that retrieves a list of all the configuration objects from the given item A configuration object can be returned for each parent community/collectionstatic List<DiscoveryConfiguration>getAllDiscoveryConfigurations(Context context, WorkspaceItem witem) Return all the discovery configuration applicable to the provided workspace itemstatic List<DiscoveryConfiguration>getAllDiscoveryConfigurations(Context context, WorkflowItem witem) Return all the discovery configuration applicable to the provided workflow itemstatic DiscoveryConfigurationRetrieves the Discovery Configuration for a null context, prefix and DSpace object.static DiscoveryConfigurationgetDiscoveryConfiguration(Context context, String prefix, DSpaceObject dso) Return the discovery configuration to use in a specific scope for the king of search identified by the prefix.static DiscoveryConfigurationgetDiscoveryConfiguration(Context context, DSpaceObject dso) Retrieves the Discovery Configuration with a null prefix for a DSpace object.static DiscoveryConfigurationgetDiscoveryConfigurationByDSO(Context context, DSpaceObject dso) Return the discovery configuration for the provided DSOstatic DiscoveryConfigurationgetDiscoveryConfigurationByName(String configurationName) Return the discovery configuration identified by the specified namegetIgnoredMetadataFields(int type) static DiscoverQueryBuilderstatic SearchServiceReturn an instance of theSearchService.
-
Field Details
-
AUTHORITY_SEPARATOR
- See Also:
-
LAST_INDEXED_FIELD
- See Also:
-
RESOURCE_UNIQUE_ID
- See Also:
-
RESOURCE_TYPE_FIELD
- See Also:
-
RESOURCE_ID_FIELD
- See Also:
-
NAMED_RESOURCE_TYPE
- See Also:
-
FILTER_SEPARATOR
- See Also:
-
-
Method Details
-
getSearchService
Return an instance of theSearchService. -
clearCachedSearchService
public static void clearCachedSearchService()Clear the cachedSearchServiceinstance, forcing it to be retrieved from the service manager again next timegetSearchService()is called. In practice, this is only necessary for integration tests in some environments where the cached version may no longer be up to date between tests. -
getDiscoveryConfiguration
Retrieves the Discovery Configuration for a null context, prefix and DSpace object. This will result in returning the default configuration- Returns:
- the default configuration
-
getDiscoveryConfiguration
Retrieves the Discovery Configuration with a null prefix for a DSpace object.- Parameters:
context- the database contextdso- the DSpace object- Returns:
- the Discovery Configuration for the specified DSpace object
-
getDiscoveryConfiguration
public static DiscoveryConfiguration getDiscoveryConfiguration(Context context, String prefix, DSpaceObject dso) Return the discovery configuration to use in a specific scope for the king of search identified by the prefix. A null prefix mean the normal query, other predefined values are workspace or workflow- Parameters:
context- the database contextprefix- the namespace of the configuration to lookup if anydso- the DSpaceObject- Returns:
- the discovery configuration for the specified scope
-
addDiscoveryConfigurationForParents
public static Set<DiscoveryConfiguration> addDiscoveryConfigurationForParents(Context context, Set<DiscoveryConfiguration> configurations, String prefix, DSpaceObject dso) throws SQLException Retrieve the configuration for the current dspace object and all its parents and add it to the provided set- Parameters:
context- - The database contextconfigurations- - The set of configurations to add the retrieved configurations toprefix- - The namespace of the configuration to lookup if anydso- - The DSpace Object- Returns:
- the set of configurations with additional retrieved ones for the dspace object and parents
- Throws:
SQLException
-
getDiscoveryConfigurationByName
Return the discovery configuration identified by the specified name- Parameters:
configurationName- the configuration name assigned to the bean in the discovery.xml- Returns:
- the discovery configuration
-
getDiscoveryConfigurationByDSO
public static DiscoveryConfiguration getDiscoveryConfigurationByDSO(Context context, DSpaceObject dso) Return the discovery configuration for the provided DSO- Parameters:
context- - The database contextdso- - The DSpace object to retrieve the configuration for- Returns:
- the discovery configuration for the provided DSO
-
getConfigurationService
-
getIgnoredMetadataFields
-
getAllDiscoveryConfigurations
public static List<DiscoveryConfiguration> getAllDiscoveryConfigurations(Context context, Item item) throws SQLException Method that retrieves a list of all the configuration objects from the given item A configuration object can be returned for each parent community/collection- Parameters:
context- the database contextitem- the DSpace item- Returns:
- a list of configuration objects
- Throws:
SQLException- An exception that provides information on a database access error or other errors.
-
getAllDiscoveryConfigurations
public static List<DiscoveryConfiguration> getAllDiscoveryConfigurations(Context context, WorkspaceItem witem) throws SQLException Return all the discovery configuration applicable to the provided workspace item- Parameters:
context-witem- a workspace item- Returns:
- a list of discovery configuration
- Throws:
SQLException
-
getAllDiscoveryConfigurations
public static List<DiscoveryConfiguration> getAllDiscoveryConfigurations(Context context, WorkflowItem witem) throws SQLException Return all the discovery configuration applicable to the provided workflow item- Parameters:
context-witem- a workflow item- Returns:
- a list of discovery configuration
- Throws:
SQLException
-
getQueryBuilder
-