Uploaded image for project: 'Solr'
  1. Solr
  2. SOLR-5529

Add Support for queries to use multiple suggesters (new Suggester Component)

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 4.7, 6.0
    • 4.7, 6.0
    • None

    Description

      Following the discussion on SOLR-5528. It would be nice to support suggest queries to be processed by more than one suggesters configured in one suggest component.

      The new response format is as follows:

      {
          responseHeader: {
              status: 0,
              QTime: 3
          },
          suggest: {
              suggester1: {
                  e: {
                      numFound: 1,
                      suggestions: [
                          {
                              term: "electronics and computer1",
                              weight: 100,
                              payload: ""
                          }
                      ]
                  }
              },
              suggester2: {
                  e: {
                      numFound: 1,
                      suggestions: [
                          {
                              term: "electronics and computer1",
                              weight: 10,
                              payload: ""
                          }
                      ]
                  }
              }
          }
      }
      

      where 'suggest1' and 'suggest2' are the names of the configured suggester and 'e' is the query.

      Example query:

      localhost:8983/solr/suggest?suggest=true&suggest.dictionary=suggest1&suggest.dictionary=suggest2&suggest.q=e
      

      Example configuration:

        <searchComponent name="suggest" class="solr.SuggestComponent">
        	<lst name="suggester">
            <str name="name">suggester1</str>
            <str name="lookupImpl">FuzzyLookupFactory</str>      
            <str name="dictionaryImpl">DocumentDictionaryFactory</str>      
            <str name="field">cat</str>
            <str name="weightField">price</str>
            <str name="suggestAnalyzerFieldType">string</str>
          </lst>
        	<lst name="suggester">
            <str name="name">suggester2</str>
            <str name="lookupImpl">FuzzyLookupFactory</str>      
            <str name="dictionaryImpl">DocumentDictionaryFactory</str>     
            <str name="field">name</str>
            <str name="weightField">price</str>
            <str name="suggestAnalyzerFieldType">string</str>
          </lst>
        </searchComponent>
      

      Attachments

        1. SOLR-5529.patch
          39 kB
          Areek Zillur
        2. SOLR-5529.patch
          43 kB
          Areek Zillur

        Issue Links

          Activity

            People

              Unassigned Unassigned
              areek Areek Zillur
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: