Solr
  1. Solr
  2. SOLR-5529

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

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 4.7, 5.0
    • Fix Version/s: 4.7, 5.0
    • Labels:
      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>
      
      1. SOLR-5529.patch
        39 kB
        Areek Zillur
      2. SOLR-5529.patch
        43 kB
        Areek Zillur

        Issue Links

          Activity

          Hide
          Areek Zillur added a comment -

          Initial patch:

          • Allow users to specify multiple suggesters (configured in one suggestComponent)
          • Added distributed support
          • Added tests
          Show
          Areek Zillur added a comment - Initial patch: Allow users to specify multiple suggesters (configured in one suggestComponent) Added distributed support Added tests
          Hide
          Areek Zillur added a comment -

          The patch will be valid only when SOLR-5528 is checked in, as it depends on the new suggester result format.

          Show
          Areek Zillur added a comment - The patch will be valid only when SOLR-5528 is checked in, as it depends on the new suggester result format.
          Hide
          Areek Zillur added a comment -

          Updated Patch:

          • Allow all the suggesters in a component to be build/reloaded with a single command (buildAll & reloadAll)
          • Added tests for normal & distributed cases
          Show
          Areek Zillur added a comment - Updated Patch: Allow all the suggesters in a component to be build/reloaded with a single command (buildAll & reloadAll) Added tests for normal & distributed cases
          Hide
          Robert Muir added a comment -

          The format change looks fine to me.

          If we want to support multiple suggesters ever, we should do this before 4.7 is released, otherwise it will get more difficult because of backwards compatibility.

          Erick Erickson do you have any thoughts? I think you had raised thoughts on this feature before.

          Show
          Robert Muir added a comment - The format change looks fine to me. If we want to support multiple suggesters ever, we should do this before 4.7 is released, otherwise it will get more difficult because of backwards compatibility. Erick Erickson do you have any thoughts? I think you had raised thoughts on this feature before.
          Hide
          Erick Erickson added a comment -

          Right, this format looks great to me, it fully addresses the point I raised.

          +1

          Show
          Erick Erickson added a comment - Right, this format looks great to me, it fully addresses the point I raised. +1
          Hide
          Robert Muir added a comment -

          OK, ill take the issue. Thanks Erick.

          Show
          Robert Muir added a comment - OK, ill take the issue. Thanks Erick.
          Hide
          ASF subversion and git services added a comment -

          Commit 1557206 from Robert Muir in branch 'dev/trunk'
          [ https://svn.apache.org/r1557206 ]

          SOLR-5529: add support for queries to use multiple suggesters in SuggestComponent

          Show
          ASF subversion and git services added a comment - Commit 1557206 from Robert Muir in branch 'dev/trunk' [ https://svn.apache.org/r1557206 ] SOLR-5529 : add support for queries to use multiple suggesters in SuggestComponent
          Hide
          Robert Muir added a comment -

          Thanks Areek!

          Show
          Robert Muir added a comment - Thanks Areek!
          Hide
          ASF subversion and git services added a comment -

          Commit 1557212 from Robert Muir in branch 'dev/branches/branch_4x'
          [ https://svn.apache.org/r1557212 ]

          SOLR-5529: add support for queries to use multiple suggesters in SuggestComponent

          Show
          ASF subversion and git services added a comment - Commit 1557212 from Robert Muir in branch 'dev/branches/branch_4x' [ https://svn.apache.org/r1557212 ] SOLR-5529 : add support for queries to use multiple suggesters in SuggestComponent
          Hide
          Areek Zillur added a comment -

          Thanks for committing this, Robert!

          Show
          Areek Zillur added a comment - Thanks for committing this, Robert!

            People

            • Assignee:
              Unassigned
              Reporter:
              Areek Zillur
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development