Interface SolrSearchClient


  • public interface SolrSearchClient
    SolrSearchClient is a client service object enabling easy access to the Solr search services integrated with iKnowBase.
    • Method Summary

      All Methods Instance Methods Abstract Methods Deprecated Methods 
      Modifier and Type Method Description
      boolean applyCommonParameters​(org.apache.solr.client.solrj.SolrQuery query)
      Applies common search parameters from the request to the query.
      org.apache.solr.client.solrj.response.QueryResponse execute​(org.apache.solr.client.solrj.SolrQuery query)
      Deprecated.
      void execute​(org.apache.solr.client.solrj.SolrQuery query, String writerType, Consumer<Reader> processor)
      Deprecated.
      org.apache.solr.client.solrj.response.QueryResponse execute​(org.apache.solr.common.params.SolrParams query)
      Executes a query on the SolrQuery.
      void execute​(org.apache.solr.common.params.SolrParams query, String writerType, Consumer<Reader> processor)
      Executes a query on the solr server, without parsing the return value.
      ContentViewerNavigationModel getNavigationModel​(org.apache.solr.client.solrj.response.QueryResponse solrResponse, String startRowParameter)
      Returns a navigation model which generates URLs for navigating the result set.
      org.apache.solr.client.solrj.SolrQuery getQuery​(String queryName)
      Gets a SolrQuery object from session (if present), or creates a new SolrQuery and stores in session.
      ContentViewerRowSetModel getRowSet​(org.apache.solr.client.solrj.response.QueryResponse solrResponse, String presentationStyleExternalKey)
      Returns a ContentViewerRowSetModel containing rows corresponding to the specified presentation style, for the results returned by Solr.
      org.apache.solr.client.solrj.SolrQuery newQuery()
      Creates a new SolrQuery object, ready for use.
    • Method Detail

      • getQuery

        org.apache.solr.client.solrj.SolrQuery getQuery​(String queryName)
        Gets a SolrQuery object from session (if present), or creates a new SolrQuery and stores in session. This method is useful when you want to reuse a SolrQuery betweeen requests. For example, to ease navigation, sorting and faceting, it is convenient to reuse the same already-configured query object.
        Parameters:
        queryName - the logical name of the query, used to store the query in the session
        Returns:
        the new SolrQuery object
      • newQuery

        org.apache.solr.client.solrj.SolrQuery newQuery()
        Creates a new SolrQuery object, ready for use. This method is useful when you always want a new SolrQuery object, and don't want to store it for another request.
        Returns:
        the new SolrQuery object
      • applyCommonParameters

        boolean applyCommonParameters​(org.apache.solr.client.solrj.SolrQuery query)
        Applies common search parameters from the request to the query. This method applies one (and only one) of the following parameters, checking in the order specified.

        • q=string - the query string
        • start=### - the start row, 0 means the first row
        • addFilterQuery=string - adds a filter query
        • removeFilterQuery=string - removes a filter query
        • addSortField=string&sortOrder={asc|desc} - Adds a sort field
        • removesortField=string - Removes a sort field

        Note that if the request specifies a new query (using ?q=string), this method will call ModifiableSolrParams.clear().

        Parameters:
        query - The SolrQuery to apply the parameters to
        Returns:
        whether the query was clear()ed or not
      • execute

        org.apache.solr.client.solrj.response.QueryResponse execute​(org.apache.solr.common.params.SolrParams query)
                                                             throws Exception
        Executes a query on the SolrQuery. This method finds the appropriate Solr URLs, adds required security information, and executes the query. This method also includes special handling of debugging requests. If the debugging flag is set (i.e SolrQuery.get("debugQuery") returns non-null), the request will be executed using an XMLResponseParser, and the XML generated by the Solr server will be stored. This method will then return a specialized SolrQuery which includes a method "String getResponseString()".
        Parameters:
        query - query to run
        Returns:
        query response
        Throws:
        Exception - when something goes wrong
      • execute

        @Deprecated
        org.apache.solr.client.solrj.response.QueryResponse execute​(org.apache.solr.client.solrj.SolrQuery query)
                                                             throws Exception
        Deprecated.
        Throws:
        Exception
      • execute

        void execute​(org.apache.solr.common.params.SolrParams query,
                     String writerType,
                     Consumer<Reader> processor)
              throws IOException,
                     org.apache.solr.client.solrj.SolrServerException
        Executes a query on the solr server, without parsing the return value. This method finds the appropriate Solr URLs, adds required security information, and executes the query. The method will not parse the return content, but instead call the specified processor with the data returned from the server.
        Parameters:
        query - query to run
        writerType - WriterType to pass to solr server as the "wt" query parameter; often "json" or "xml"
        processor - Consumer that will receive the data for processing
        Throws:
        IOException
        org.apache.solr.client.solrj.SolrServerException
      • execute

        @Deprecated
        void execute​(org.apache.solr.client.solrj.SolrQuery query,
                     String writerType,
                     Consumer<Reader> processor)
              throws IOException,
                     org.apache.solr.client.solrj.SolrServerException
        Deprecated.
        Throws:
        IOException
        org.apache.solr.client.solrj.SolrServerException
      • getRowSet

        ContentViewerRowSetModel getRowSet​(org.apache.solr.client.solrj.response.QueryResponse solrResponse,
                                           String presentationStyleExternalKey)
        Returns a ContentViewerRowSetModel containing rows corresponding to the specified presentation style, for the results returned by Solr.
        Parameters:
        solrResponse - query response to get rowset for
        presentationStyleExternalKey - external key of presentation style to use
        Returns:
        output from running the presentation style
      • getNavigationModel

        ContentViewerNavigationModel getNavigationModel​(org.apache.solr.client.solrj.response.QueryResponse solrResponse,
                                                        String startRowParameter)
        Returns a navigation model which generates URLs for navigating the result set. Since the URLs include only a startRow-parameter, you should reuse the same SolrQuery throughout the session using getQuery(String)
        Parameters:
        solrResponse - the response object to navigate
        Returns:
        a navigation model for the result set