Class SearchRequestBuilder

    • Constructor Summary

      Constructors 
      Constructor Description
      SearchRequestBuilder​(java.lang.String base, java.lang.String dataset)
      Create a search request builder
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      SearchRequestBuilder exclude​(java.lang.String field, java.lang.String value)
      Sets a value to filter results by, excluding matches
      Sets the `exclude.{field}` parameter when sending a request to the API
      java.lang.String getUrl()
      Returns the URL that will be queried by the request
      SearchRequestBuilder refineBy​(java.lang.String field, java.lang.String value)
      Sets a value to filter by, only including matches
      Sets the `refine.{field}` parameter when sending a request to the API
      SearchResponse sendRequest()
      Send the completed request to the API, returns the response
      SearchRequestBuilder setLimit​(int n)
      Sets the maximum number of search results to show
      Sets the `row` parameter when sending a request to the API
      SearchRequestBuilder setOffset​(int n)
      Sets how many results to skip (e.g.
      SearchRequestBuilder setQuery​(java.lang.String query)
      Set the long query string
      Sets the `q` parameter when sending a request to the API
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • SearchRequestBuilder

        public SearchRequestBuilder​(java.lang.String base,
                                    java.lang.String dataset)
        Create a search request builder
        Parameters:
        base - URL where datasets can be found (do not include API endpoints)
        dataset - dataset to search
    • Method Detail

      • setQuery

        public SearchRequestBuilder setQuery​(java.lang.String query)
        Set the long query string
        Sets the `q` parameter when sending a request to the API
        Parameters:
        query - long query string
        Returns:
        this object, for chaining
      • setLimit

        public SearchRequestBuilder setLimit​(int n)
        Sets the maximum number of search results to show
        Sets the `row` parameter when sending a request to the API
        Parameters:
        n - maximum number of search results to show
        Returns:
        this object, for chaining
      • setOffset

        public SearchRequestBuilder setOffset​(int n)
        Sets how many results to skip (e.g. for pagination)
        Sets the `start` parameter when sending a request to the API
        Parameters:
        n - how many to results to offset by
        Returns:
        this object, for chaining
      • refineBy

        public SearchRequestBuilder refineBy​(java.lang.String field,
                                             java.lang.String value)
        Sets a value to filter by, only including matches
        Sets the `refine.{field}` parameter when sending a request to the API
        Parameters:
        field - field to filter by
        value - value to match
        Returns:
        this object, for chaining
      • exclude

        public SearchRequestBuilder exclude​(java.lang.String field,
                                            java.lang.String value)
        Sets a value to filter results by, excluding matches
        Sets the `exclude.{field}` parameter when sending a request to the API
        Parameters:
        field - field to filter by
        value - value to match
        Returns:
        this object, for chaining