Gravatar for wvuong@captechconsulting.com

Question by wvuong, Jan 20, 2016 12:12 PM

CoveoFieldSuggestions Multiple Data Fields and Total Number of Suggestions

I have multiple instances of the CoveoFieldSuggestions in order to have query suggestions for multiple fields. I know I can specify the number of suggestions per field, but since i have so many, this can lead to 20 or more suggestions. Is there a way to set the number of suggestions that all the CoveoFieldSuggestions as a whole can contribute?

Is there someway to specify multiple fields per one CoveoFieldSuggestion instance?

Example Code:

<div class="CoveoFieldSuggestions" data-field="@Model.ToCoveoFieldName("first name")" data-header-title="First Name"></div>
<div class="CoveoFieldSuggestions" data-field="@Model.ToCoveoFieldName("last name")" data-header-title="Last Name"></div>
<div class="CoveoFieldSuggestions" data-field="@Model.ToCoveoFieldName("bio")" data-header-title="Bio"></div>
<div class="CoveoFieldSuggestions" data-field="@Model.ToCoveoFieldName("education")" data-header-title="Education"></div>
<div class="CoveoFieldSuggestions" data-field="@Model.ToCoveoFieldName("address name")" data-header-title="Address Name"></div>
<div class="CoveoFieldSuggestions" data-field="@Model.ToCoveoFieldName("line 1")" data-header-title="Line 1"></div>
<div class="CoveoFieldSuggestions" data-field="@Model.ToCoveoFieldName("line 2")" data-header-title="Line 2"></div>
<div class="CoveoFieldSuggestions" data-field="@Model.ToCoveoFieldName("city")" data-header-title="City"></div>
<div class="CoveoFieldSuggestions" data-field="@Model.ToCoveoFieldName("state")" data-header-title="State"></div>
<div class="CoveoFieldSuggestions" data-field="@Model.ToCoveoFieldName("ZipCode")" data-header-title="ZipCode"></div>
1 Reply
Gravatar for mlaporte@coveo.com

Answer by Martin Laporte, Jan 22, 2016 4:58 AM

As of now, you can't restrict the total number of values displayed through multiple field suggestions. Also you can't include multiple fields for a single CoveoFieldSuggestions.

An option for you would be to implement the fetching of suggestions manually through REST calls. This way you could enforce as many rules as you want from values originating from multiple fields (see https://developers.coveo.com/display/JsSearchV1/Providing+Suggestions+for+the+Omnibox ).

Gravatar for jflheureux@coveo.com

Comment by Jean-François L'Heureux, Jan 22, 2016 9:28 AM

If you are using Coveo for Sitecore 3.0, the version of the Coveo JavaScript Search Framework included is 0.9. You should use the documentation for that specific version: https://developers.coveo.com/display/JsSearch

Specifically: https://developers.coveo.com/display/JsSearch/Providing+Suggestions+for+the+Omnibox

Ask a question