Class SolrLocalResponseBuilder

  • All Implemented Interfaces:
    Closeable, AutoCloseable

    public class SolrLocalResponseBuilder
    extends Object
    implements Closeable
    Builder for a Solr response using a local Solr request.

    Always use inside try with resources!

    • Constructor Summary

      Constructors 
      Constructor Description
      SolrLocalResponseBuilder​(org.apache.solr.handler.component.ResponseBuilder origin)
      Create local request builder from originating request.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      org.apache.solr.handler.component.ResponseBuilder build()
      Create a response builder.
      void close()  
      static org.apache.solr.common.params.ModifiableSolrParams computeUnscoredSolrParams​(org.apache.solr.common.params.SolrParams origParams)
      This takes the original incoming solr params and removes all scoring, boosting, grouping, collapsing and expanding params.
      static org.apache.solr.common.params.ModifiableSolrParams computeUnscoredSolrQueryParams​(org.apache.solr.common.params.SolrParams original)
      This takes the original incoming solr params and creates new solr query params that contain query and filter query params only.
      static void execute​(org.apache.solr.handler.component.ResponseBuilder response)
      Execute request by calling the search components directly.
      static org.apache.solr.handler.component.FacetComponent extractFacetComponent​(List<org.apache.solr.handler.component.SearchComponent> components)
      Returns the facetComponent in components and null if no FacetComponent is present
      static org.apache.solr.handler.component.QueryComponent extractQueryComponent​(List<org.apache.solr.handler.component.SearchComponent> components)
      Returns the queryComponent in components and null if no QueryComponent is present
      SolrLocalResponseBuilder useFacetComponent()
      Use facet component too.
      SolrLocalResponseBuilder useParams​(org.apache.solr.common.params.SolrParams params)
      Use the given parameters for the request.
      SolrLocalResponseBuilder useUnscoredSolrParams()
      This takes the original incoming solr params and removes all scoring, boosting, grouping, collapsing and expanding params.
    • Constructor Detail

      • SolrLocalResponseBuilder

        public SolrLocalResponseBuilder​(org.apache.solr.handler.component.ResponseBuilder origin)
        Create local request builder from originating request. Uses query component only.
        Parameters:
        origin - Originating request.
    • Method Detail

      • useUnscoredSolrParams

        public SolrLocalResponseBuilder useUnscoredSolrParams()
        This takes the original incoming solr params and removes all scoring, boosting, grouping, collapsing and expanding params. It furthermore disables all spellchecking and query reductions.
        Returns:
        this for method chaining.
      • useParams

        public SolrLocalResponseBuilder useParams​(org.apache.solr.common.params.SolrParams params)
        Use the given parameters for the request.
        Returns:
        this for method chaining.
      • useFacetComponent

        public SolrLocalResponseBuilder useFacetComponent()
        Use facet component too.
        Returns:
        this for method chaining.
      • build

        public org.apache.solr.handler.component.ResponseBuilder build()
        Create a response builder.
      • execute

        public static void execute​(org.apache.solr.handler.component.ResponseBuilder response)
                            throws IOException
        Execute request by calling the search components directly.
        Throws:
        IOException
      • computeUnscoredSolrQueryParams

        public static org.apache.solr.common.params.ModifiableSolrParams computeUnscoredSolrQueryParams​(org.apache.solr.common.params.SolrParams original)
        This takes the original incoming solr params and creates new solr query params that contain query and filter query params only. Sort params are replaced in order to reflect unscored document retrieval.

        Use these params on a subset of search components like the query and facet component only. With this shorter query params all clutter is removed from the query.

      • computeUnscoredSolrParams

        public static org.apache.solr.common.params.ModifiableSolrParams computeUnscoredSolrParams​(org.apache.solr.common.params.SolrParams origParams)
        This takes the original incoming solr params and removes all scoring, boosting, grouping, collapsing and expanding params. It furthermore disables all spellchecking and query reductions.
      • extractQueryComponent

        public static org.apache.solr.handler.component.QueryComponent extractQueryComponent​(List<org.apache.solr.handler.component.SearchComponent> components)
        Returns the queryComponent in components and null if no QueryComponent is present
      • extractFacetComponent

        public static org.apache.solr.handler.component.FacetComponent extractFacetComponent​(List<org.apache.solr.handler.component.SearchComponent> components)
        Returns the facetComponent in components and null if no FacetComponent is present