Class DefaultSolrSpellCheckContributor

java.lang.Object
com.broadleafcommerce.search.provider.solr.AbstractSolrQueryContributor
com.broadleafcommerce.search.provider.solr.DefaultSolrSpellCheckContributor
All Implemented Interfaces:
SolrQueryContributor, org.springframework.core.Ordered

public class DefaultSolrSpellCheckContributor extends AbstractSolrQueryContributor

If spell check is enabled, this sets the necessary parameters on the Solr request. This includes spelling suggestions as well as collation (spell check on the entire search query).

  • Field Summary

    Fields inherited from interface org.springframework.core.Ordered

    HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
  • Constructor Summary

    Constructors
    Constructor
    Description
    DefaultSolrSpellCheckContributor(com.broadleafcommerce.search.core.spellcheck.SpellCheckProperties spellCheckProperties)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected void
    contributeInternal(org.apache.solr.client.solrj.SolrQuery solrQuery, com.broadleafcommerce.search.api.domain.SearchRequest searchRequest, List<com.broadleafcommerce.search.api.domain.FieldDefinition> fieldDefinitions, org.springframework.data.domain.Pageable page, com.broadleafcommerce.search.core.service.SearchRequestProperties properties, String locale, com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
    Customize the provided solrQuery with some additional behavior.
    protected void
    enableSpellCheck(org.apache.solr.client.solrj.SolrQuery solrQuery, com.broadleafcommerce.search.api.domain.SearchRequest searchRequest)
    Enable spell check for the Solr query and request.
    protected com.broadleafcommerce.search.core.spellcheck.SpellCheckProperties
     
    protected void
    setSuggestionQueryArgs(org.apache.solr.client.solrj.SolrQuery solrQuery, com.broadleafcommerce.search.core.spellcheck.IndexableSpellCheckProperties properties)
    Configure the Solr query to set parameters necessary for enabling auto-corrected query suggestions.
    protected boolean
    shouldContribute(org.apache.solr.client.solrj.SolrQuery solrQuery, com.broadleafcommerce.search.api.domain.SearchRequest searchRequest, org.springframework.data.domain.Pageable page, com.broadleafcommerce.search.core.service.SearchRequestProperties properties, com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
    Determines if this contributor should run.

    Methods inherited from class com.broadleafcommerce.search.provider.solr.AbstractSolrQueryContributor

    contribute

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface com.broadleafcommerce.search.provider.solr.SolrQueryContributor

    contributeOnTypeAhead, getOrder, isTypeAheadRequest
  • Constructor Details

    • DefaultSolrSpellCheckContributor

      public DefaultSolrSpellCheckContributor(com.broadleafcommerce.search.core.spellcheck.SpellCheckProperties spellCheckProperties)
  • Method Details

    • contributeInternal

      protected void contributeInternal(org.apache.solr.client.solrj.SolrQuery solrQuery, com.broadleafcommerce.search.api.domain.SearchRequest searchRequest, List<com.broadleafcommerce.search.api.domain.FieldDefinition> fieldDefinitions, org.springframework.data.domain.Pageable page, com.broadleafcommerce.search.core.service.SearchRequestProperties properties, @Nullable String locale, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
      Description copied from class: AbstractSolrQueryContributor
      Customize the provided solrQuery with some additional behavior.
      Specified by:
      contributeInternal in class AbstractSolrQueryContributor
      Parameters:
      solrQuery - The query to customize
      searchRequest - The search query request
      fieldDefinitions - The fields to perform the search on
      page - Page information for page to retrieve for query
      properties - Additional properties for this query
      locale - The locale of this search
      context - The context information surrounding sandboxing/multitenant state
    • enableSpellCheck

      protected void enableSpellCheck(org.apache.solr.client.solrj.SolrQuery solrQuery, com.broadleafcommerce.search.api.domain.SearchRequest searchRequest)
      Enable spell check for the Solr query and request.
      Parameters:
      solrQuery - Solr query to enable spell check
      searchRequest - request to enable spell check
    • setSuggestionQueryArgs

      protected void setSuggestionQueryArgs(org.apache.solr.client.solrj.SolrQuery solrQuery, com.broadleafcommerce.search.core.spellcheck.IndexableSpellCheckProperties properties)
      Configure the Solr query to set parameters necessary for enabling auto-corrected query suggestions.
      Parameters:
      solrQuery - Solr query to enable auto-corrected query suggestions
      properties - properties for configuring auto-corrected query suggestions
    • shouldContribute

      protected boolean shouldContribute(org.apache.solr.client.solrj.SolrQuery solrQuery, com.broadleafcommerce.search.api.domain.SearchRequest searchRequest, org.springframework.data.domain.Pageable page, com.broadleafcommerce.search.core.service.SearchRequestProperties properties, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
      Description copied from class: AbstractSolrQueryContributor
      Determines if this contributor should run.
      Specified by:
      shouldContribute in class AbstractSolrQueryContributor
      Parameters:
      solrQuery - The query to customize
      searchRequest - The search query request
      page - Page information for page to retrieve for query
      properties - Additional properties for this query.
      context - The context information surrounding sandboxing/multitenant state
      Returns:
      whether this contributor should run
    • getSpellCheckProperties

      protected com.broadleafcommerce.search.core.spellcheck.SpellCheckProperties getSpellCheckProperties()