Package org.dspace.discovery
Class DiscoverQuery
- java.lang.Object
-
- org.dspace.discovery.DiscoverQuery
-
public class DiscoverQuery extends Object
This class represents a query which the discovery backend can use- Author:
- Kevin Van de Velde (kevin at atmire dot com)
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classDiscoverQuery.SORT_ORDERAttributes used for sorting of results
-
Constructor Summary
Constructors Constructor Description DiscoverQuery()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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)StringgetDiscoveryConfigurationName()Return the name of discovery configuration used by this queryStringgetDSpaceObjectFilter()Gets the DSpace object filter can be used to only return objects from a certain DSpace Object typeList<DiscoverFacetField>getFacetFields()Gets the facets fields configuredintgetFacetMinCount()Gets the minimum number of values that need to be present before a valid facet value has been foundintgetFacetOffset()Gets the facet field offsetList<String>getFacetQueries()Returns the facet queriesList<String>getFieldPresentQueries()List<String>getFilterQueries()Returns the filter queriesDiscoverHitHighlightingFieldgetHitHighlightingField(String field)List<DiscoverHitHighlightingField>getHitHighlightingFields()intgetMaxResults()The maximum number of results returned by this queryMap<String,List<String>>getProperties()Returns the misc search propertiesStringgetQuery()List<String>getSearchFields()Get list of fields which Discovery will return in the search resultsStringgetSortField()DiscoverQuery.SORT_ORDERgetSortOrder()intgetStart()booleanisSpellCheck()voidsetDiscoveryConfigurationName(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 queryvoidsetQuery(String query)voidsetSortField(String sortField, DiscoverQuery.SORT_ORDER sortOrder)voidsetSpellCheck(boolean spellCheck)voidsetStart(int start)
-
-
-
Method Detail
-
setQuery
public void setQuery(String query)
-
getQuery
public String getQuery()
-
getStart
public int getStart()
-
setStart
public void setStart(int start)
-
setSortField
public void setSortField(String sortField, DiscoverQuery.SORT_ORDER sortOrder)
-
getSortField
public String getSortField()
-
getSortOrder
public DiscoverQuery.SORT_ORDER getSortOrder()
-
setDSpaceObjectFilter
public void setDSpaceObjectFilter(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 type- Parameters:
DSpaceObjectFilter- the DSpace object filer
-
getDSpaceObjectFilter
public String getDSpaceObjectFilter()
Gets the DSpace object filter can be used to only return objects from a certain DSpace Object type- Returns:
- the DSpace object filer
-
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
public void addFilterQueries(String... filterQueries)
Adds new filter queries- Parameters:
filterQueries- the filter queries to be added
-
getFilterQueries
public List<String> getFilterQueries()
Returns the filter queries- Returns:
- the filter queries in a list
-
addFieldPresentQueries
public void addFieldPresentQueries(String... fieldPresentQueries)
Adds a query that will ensure that a certain field is present in the index- Parameters:
fieldPresentQueries- the queries to be added
-
addFacetQuery
public void addFacetQuery(String facetQuery)
Adds a new facet query- Parameters:
facetQuery- the new facet query to be added
-
getFacetQueries
public List<String> getFacetQueries()
Returns the facet queries- Returns:
- the facet queries for this query
-
addFacetField
public void addFacetField(DiscoverFacetField facetField)
Adds a new facet field- Parameters:
facetField- the new facet field to be added
-
getFacetFields
public List<DiscoverFacetField> 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
public void addSearchField(String field)
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 backends (like Solr) will return everything.- Parameters:
field- field to add to the list of fields returned
-
getSearchFields
public List<String> getSearchFields()
Get list of fields which Discovery will return in the search results- Returns:
- List of field names
-
getProperties
public Map<String,List<String>> getProperties()
Returns the misc search properties- Returns:
- a map containing the properties
-
addProperty
public void addProperty(String property, String value)
Adds a new search property to the misc search properties- Parameters:
property- the name of the propertyvalue- the value of the property
-
getHitHighlightingField
public DiscoverHitHighlightingField getHitHighlightingField(String field)
-
getHitHighlightingFields
public List<DiscoverHitHighlightingField> getHitHighlightingFields()
-
addHitHighlightingField
public void addHitHighlightingField(DiscoverHitHighlightingField hitHighlighting)
-
isSpellCheck
public boolean isSpellCheck()
-
setSpellCheck
public void setSpellCheck(boolean spellCheck)
-
addYearRangeFacet
public void addYearRangeFacet(DiscoverySearchFilterFacet facet, FacetYearRange facetYearRange)
-
getDiscoveryConfigurationName
public String getDiscoveryConfigurationName()
Return the name of discovery configuration used by this query- Returns:
- the discovery configuration name used
-
setDiscoveryConfigurationName
public void setDiscoveryConfigurationName(String discoveryConfigurationName)
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
-
-