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, Trunk
    • Fix Version/s: 4.7, Trunk
    • 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
        43 kB
        Areek Zillur
      2. SOLR-5529.patch
        39 kB
        Areek Zillur

        Issue Links

          Activity

          Areek Zillur created issue -
          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
          Areek Zillur made changes -
          Field Original Value New Value
          Attachment SOLR-5529.patch [ 12617140 ]
          Areek Zillur made changes -
          Link This issue is blocked by SOLR-5528 [ SOLR-5528 ]
          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.
          Areek Zillur made changes -
          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:
          {code}
          {
              responseHeader: {
                  status: 0,
                  QTime: 45
              },
              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: ""
                              }
                          ]
                      }
                  }
              }
          }
          {code}
          where 'suggest1' and 'suggest2' are the names of the configured suggester and 'e' is the query.

          Example configuration:
          {code}
            <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>
          {code}
          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:
          {code}
          {
              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: ""
                              }
                          ]
                      }
                  }
              }
          }
          {code}
          where 'suggest1' and 'suggest2' are the names of the configured suggester and 'e' is the query.

          Example query:
          {code}
          localhost:8983/solr/suggest?suggest=true&suggest.dictionary=suggest1&suggest.dictionary=suggest2&suggest.q=e
          {code}

          Example configuration:
          {code}
            <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>
          {code}
          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
          Areek Zillur made changes -
          Attachment SOLR-5529.patch [ 12617791 ]
          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!
          Robert Muir made changes -
          Status Open [ 1 ] Resolved [ 5 ]
          Resolution Fixed [ 1 ]
          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!
          Areek Zillur made changes -
          Link This issue relates to SOLR-5378 [ SOLR-5378 ]
          David Smiley made changes -
          Status Resolved [ 5 ] Closed [ 6 ]
          Transition Time In Source Status Execution Times Last Executer Last Execution Date
          Open Open Resolved Resolved
          36d 8h 27m 1 Robert Muir 10/Jan/14 18:23
          Resolved Resolved Closed Closed
          64d 18h 40m 1 David Smiley 16/Mar/14 13:03

            People

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

              Dates

              • Created:
                Updated:
                Resolved:

                Development