Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
334 views
in Technique[技术] by (71.8m points)

solrcloud - Solr Suggestion with multiple payloads

We are using Solr suggester feature for businessName lookup. As user enters the query, along with the matched names, we want solr to send other attributes from profile like id, address, city, state, country etc. fields.

I tried to configure multiple fields in solr suggester using payloadField tag but it is returning only the first field. I have tried putting them in comma separated fashion, but no luck. Here is the current config from solrconfig.xml file.

<searchComponent name="suggest" class="solr.SuggestComponent">
    <lst name="suggester">
        <str name="name">suggest</str>
        <str name="lookupImpl">AnalyzingLookupFactory</str>
        <str name="storeDir">suggester_fuzzy_dir</str>
        <str name="dictionaryImpl">DocumentDictionaryFactory</str>
        <str name="field">businessName</str>
        <str name="payloadField">profileId</str> 
        <str name="payloadField">email</str>
        <str name="payloadField">city</str>
        <str name="payloadField">state</str>
        <str name="payloadField">postalCode</str>
        <str name="payloadField">phoneNumber</str>
        <str name="weightField">businessName</str>
        <str name="suggestAnalyzerFieldType">text_general</str>
        <str name="buildOnStartup">true</str>
        <str name="buildOnCommit">true</str>
        <str name="preserveSep">false</str>
    </lst>
</searchComponent>

What configuration is required to send multiple payloads in result? Thanks.


Edit:
This is current output of the solr suggester.

    {
        "suggest": {
            "suggest": {
                "Rock": {
                    "numFound": 1,
                    "suggestions": [
                        {
                            "term": "Rockview Properties",
                            "weight": 0,
                            "payload": "123456789"
                        }
                    ]
                }
            }
        }
    }

My Expectation:
A way in which suggester payload contains more than one field. The payload field also contain the information that what data belongs to which field. I am not looking for copying all the data in a single field using copyField tag and then passing as payload approach.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

I have been doing online reading and search for the issue, sending multiple payload while returning solr suggester results. I found that, we can send only one field as payload from our index.

Reference: Link

Further suggestions are welcome.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...