Class 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)
    • Constructor Detail

      • DiscoverQuery

        public DiscoverQuery()
    • Method Detail

      • setQuery

        public void setQuery​(String query)
      • getQuery

        public String getQuery()
      • getStart

        public int getStart()
      • setStart

        public void setStart​(int start)
      • getSortField

        public String getSortField()
      • 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
      • getFieldPresentQueries

        public List<String> getFieldPresentQueries()
      • 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 property
        value - the value of the property
      • isSpellCheck

        public boolean isSpellCheck()
      • setSpellCheck

        public void setSpellCheck​(boolean spellCheck)
      • 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