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

Erick Erickson commented on SOLR-5528:
--------------------------------------

Areek:

As luck would have it, a client noticed that you can string two or more 
suggesters together by listing multiple components in the request handler 
<components> section.. I posted a detailed account on the dev list. This allows 
getting suggestions from multiple fields (or whatever components you define) in 
separate sections of the response. I'm not that sure whether this is intended 
behavior or serendipitous. 

The crux of the matter is that I can see it being useful to return the name of 
the component in the suggest section, perhaps a sibling to "numFound" (?) it 
would help disambiguate the response and might help with distributed 
processing. But I'm guessing on this last.

If we're changing the response format anyway, do you see any harm in putting 
this added bit in? I hacked a _very_ quick test in by changing toNamedList in 
SpellCheckComponent, adding getName() to the call, like this:

NamedList suggestions = toNamedList(getName(), [all the rest of the parameters 
just as now]).

then adding the string from getName() in to the named list. getName(), of 
course, is just the bits from
{{
    <arr name="components">
      <str>name</str>
      <str>features</str>
    </arr>
}}

i.e. "name" and "features" in this example.

FWIW,
Erick


> 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