Solr Suggestion with multiple payloads

坚强是说给别人听的谎言 提交于 2019-11-27 06:50:17

问题


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.


回答1:


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.



来源:https://stackoverflow.com/questions/32434186/solr-suggestion-with-multiple-payloads

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!