[ 
https://issues.apache.org/jira/browse/SOLR-5528?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13839777#comment-13839777
 ] 

Areek Zillur commented on SOLR-5528:
------------------------------------

Sorry for the joining so late in the discussion!

My thoughts: 
  - I think using several suggest component to solve any use case is not ideal! 
The same use cases (as mentioned my Erick) can be solved if there was a way to 
get suggestions from multiple dictionaries at one go.

So in order to fulfill these use-cases, I believe we should allow users to 
'query' multiple suggesters in one <b>single</b> component.

Example config:
{code}
<searchComponent class="solr.SuggestComponent" name="suggest">
    <lst name="suggester">
      <str name="name">name_suggester</str>
      <str name="lookupImpl">FuzzyLookupFactory</str>
      <str name="dictionaryImpl">DocumentDictionaryFactory</str>
      <str name="field">cat</str>
      <str name="weightField">price</str>
      <str name="storeDir">suggest_fuzzy_doc_dict_payload</str>
      <str name="suggestAnalyzerFieldType">text</str>
      <str name="buildOnCommit">true</str>
    </lst>

    <lst name="suggester">
      <str name="name">feature_suggester</str>
      <str name="dictionaryImpl">DocumentExpressionDictionaryFactory</str>
      <str name="lookupImpl">FuzzyLookupFactory</str>
      <str name="field">cat</str>
      <str name="weightExpression">((price * 2) + weight)</str>
      <str name="sortField">weight</str>
      <str name="sortField">price</str>
      <str name="storeDir">suggest_fuzzy_doc_expr_dict</str>
      <str name="suggestAnalyzerFieldType">text</str>
      <str name="buildOnCommit">true</str>
    </lst>
  </searchComponent>
{code}
And then the user can query as follows:
 {code} 
/suggest?suggest.q=blah&suggest.dictionary=name_suggester&suggest.dictionary=feature_suggester
 {code}

In order for the user to distinguish the suggestions, we can change the 
response format to: 
{code}
{
    "responseHeader": {
        "status": 0,
        "QTime": 30
    },
    "suggest": {
        name_suggester: {
            "ele": {
            "numFound": 1,
            "suggestions": [
                {
                    "term": "electronics and computer1",
                    "weight": 2199,
                    "payload": ""
                }
            ]
        }
    },
        feature_suggester: {
            "ele": {
            "numFound": 1,
            "suggestions": [
                {
                    "term": "electronics and computer1",
                    "weight": 2199,
                    "payload": ""
                }
            ]
        }
    }
    }
}
{code}

By making sure this is done in the component level (single not multiple), we 
can also ensure that it will work in all cases that it should (distributed).

There is some changes necessary to support the proposed way, besides just the 
response format. Hence, I believe it should be done in a separate jira (will 
create and upload the patch soon).
I also dont intend to add this to the old suggester (based on spellcheck 
component) as the component is doing too many things already :).

Thoughts?

> Change New Suggester Response and minor cleanups
> ------------------------------------------------
>
>                 Key: SOLR-5528
>                 URL: https://issues.apache.org/jira/browse/SOLR-5528
>             Project: Solr
>          Issue Type: Improvement
>          Components: SearchComponents - other
>            Reporter: Areek Zillur
>             Fix For: 5.0, 4.7
>
>         Attachments: SOLR-5528.patch
>
>
> It would be nice to have a simplified response format for the new Suggester 
> Component. 
> The proposed format is as follows:
> XML: 
> {code}
> <?xml version="1.0" encoding="UTF-8"?>
> <response>
>    <lst name="responseHeader">
>       <int name="status">0</int>
>       <int name="QTime">32</int>
>    </lst>
>    <str name="command">build</str>
>    <lst name="suggest">
>       <lst name="ele">
>          <int name="numFound">1</int>
>          <arr name="suggestions">
>             <lst>
>                <str name="term">electronics and computer1</str>
>                <long name="weight">2199</long>
>                <str name="payload" />
>             </lst>
>          </arr>
>       </lst>
>    </lst>
> </response>
> {code}
> JSON:
> {code}
> {
>     "responseHeader": {
>         "status": 0,
>         "QTime": 30
>     },
>     "command": "build",
>     "suggest": {
>         "ele": {
>             "numFound": 1,
>             "suggestions": [
>                 {
>                     "term": "electronics and computer1",
>                     "weight": 2199,
>                     "payload": ""
>                 }
>             ]
>         }
>     }
> }
> {code}



--
This message was sent by Atlassian JIRA
(v6.1#6144)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org
For additional commands, e-mail: dev-h...@lucene.apache.org

Reply via email to