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 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…