Package org.dspace.discovery
Class DiscoverQuery
java.lang.Object
org.dspace.discovery.DiscoverQuery
This class represents a query which the discovery back-end can use.
- Author:
- Kevin Van de Velde (kevin at atmire dot com)
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumAttributes used for sorting of results -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddDSpaceObjectFilter(String dspaceObjectFilter) Adds a DSpace object filter, must be an DSpace Object type integer.voidaddFacetField(DiscoverFacetField facetField) Adds a new facet fieldvoidaddFacetQuery(String facetQuery) Adds a new facet queryvoidaddFieldPresentQueries(String... fieldPresentQueries) Adds a query that will ensure that a certain field is present in the indexvoidaddFilterQueries(String... filterQueries) Adds new filter queriesvoidaddHitHighlightingField(DiscoverHitHighlightingField hitHighlighting) voidaddProperty(String property, String value) Adds a new search property to the misc search propertiesvoidaddSearchField(String field) Sets the fields which you want Discovery to return in the search results.voidaddYearRangeFacet(DiscoverySearchFilterFacet facet, FacetYearRange facetYearRange) Return the name of discovery configuration used by this queryGets the DSpace object filters can be used to only return objects from certain DSpace Object typesGets the facets fields configuredintGets the minimum number of values that need to be present before a valid facet value has been foundintGets the facet field offsetReturns the facet queriesReturns the filter queriesgetHitHighlightingField(String field) intThe maximum number of results returned by this queryReturns the misc search propertiesgetQuery()Get list of fields which Discovery will return in the search resultsintgetStart()booleanvoidsetDiscoveryConfigurationName(String discoveryConfigurationName) Set the name of discovery configuration to use to run this queryvoidsetDSpaceObjectFilter(String dspaceObjectFilter) Sets the DSpace object filter, must be an DSpace Object type integer can be used to only return objects from a certain DSpace Object typevoidsetFacetMinCount(int facetMinCount) Set the minimum number of values that need to be present before a valid facet value has been foundvoidsetFacetOffset(int facetOffset) Sets the facet field offset, one facet offset will be used for all the facet fieldsvoidsetMaxResults(int maxResults) Sets the maximum number of results by this queryvoidvoidsetSortField(String sortField, DiscoverQuery.SORT_ORDER sortOrder) voidsetSpellCheck(boolean spellCheck) voidsetStart(int start)
-
Constructor Details
-
DiscoverQuery
public DiscoverQuery()
-
-
Method Details
-
setQuery
-
getQuery
-
getStart
public int getStart() -
setStart
public void setStart(int start) -
setSortField
-
getSortField
-
getSortOrder
-
setDSpaceObjectFilter
Sets the DSpace object filter, must be an DSpace Object type integer can be used to only return objects from a certain DSpace Object type- Parameters:
dspaceObjectFilter- the DSpace object filter
-
addDSpaceObjectFilter
Adds a DSpace object filter, must be an DSpace Object type integer. Can be used to also return objects from a certain DSpace Object type.- Parameters:
dspaceObjectFilter- the DSpace object filer
-
getDSpaceObjectFilters
Gets the DSpace object filters can be used to only return objects from certain DSpace Object types- Returns:
- the DSpace object filters
-
getMaxResults
public int getMaxResults()The maximum number of results returned by this query- Returns:
- the number of results
-
setMaxResults
public void setMaxResults(int maxResults) Sets the maximum number of results by this query- Parameters:
maxResults- the number of results
-
addFilterQueries
Adds new filter queries- Parameters:
filterQueries- the filter queries to be added
-
getFilterQueries
Returns the filter queries- Returns:
- the filter queries in a list
-
addFieldPresentQueries
Adds a query that will ensure that a certain field is present in the index- Parameters:
fieldPresentQueries- the queries to be added
-
getFieldPresentQueries
-
addFacetQuery
Adds a new facet query- Parameters:
facetQuery- the new facet query to be added
-
getFacetQueries
Returns the facet queries- Returns:
- the facet queries for this query
-
addFacetField
Adds a new facet field- Parameters:
facetField- the new facet field to be added
-
getFacetFields
Gets the facets fields configured- Returns:
- the facet fields for this query
-
getFacetMinCount
public int getFacetMinCount()Gets the minimum number of values that need to be present before a valid facet value has been found- Returns:
- facetMinCount the minimum number of values to be present for a valid facet
-
setFacetMinCount
public void setFacetMinCount(int facetMinCount) Set the minimum number of values that need to be present before a valid facet value has been found- Parameters:
facetMinCount- the minimum number of values to be present for a valid facet
-
getFacetOffset
public int getFacetOffset()Gets the facet field offset- Returns:
- the facet field offset
-
setFacetOffset
public void setFacetOffset(int facetOffset) Sets the facet field offset, one facet offset will be used for all the facet fields- Parameters:
facetOffset- an integer representing the offset
-
addSearchField
Sets the fields which you want Discovery to return in the search results. It is HIGHLY recommended to limit the fields returned, as by default some back-ends (like Solr) will return everything.- Parameters:
field- field to add to the list of fields returned
-
getSearchFields
Get list of fields which Discovery will return in the search results- Returns:
- List of field names
-
getProperties
Returns the misc search properties- Returns:
- a map containing the properties
-
addProperty
Adds a new search property to the misc search properties- Parameters:
property- the name of the propertyvalue- the value of the property
-
getHitHighlightingField
-
getHitHighlightingFields
-
addHitHighlightingField
-
isSpellCheck
public boolean isSpellCheck() -
setSpellCheck
public void setSpellCheck(boolean spellCheck) -
addYearRangeFacet
-
getDiscoveryConfigurationName
Return the name of discovery configuration used by this query- Returns:
- the discovery configuration name used
-
setDiscoveryConfigurationName
Set the name of discovery configuration to use to run this query- Parameters:
discoveryConfigurationName- the name of the discovery configuration to use to run this query
-