Gravatar for

Question by CambridgeAdmins, Mar 6, 2017 2:44 PM

Multi-Value Facet - SharePoint Enterprise Keywords - CES .NET

We recently made a multi-value facet that's pulling from a SharePoint enterprise keyword field. The facet seems to be having some trouble. The facet contains a lot of # symbols, and random numbers.

Example - If I were to add "Cashiering; Transfers" to a list item's enterprise keywords, then it may show up as the following independent facet items.


So, about the first 15 items in our multi-value facet are #'s and random numbers. Then, there's a list of #'s with keywords next to them. And lastly, all of the other keywords that show up normally as we'd like them to.

Is this something that anyone else has encountered before? Is it caused by the use of an enterprise keyword field in SharePoint instead of a normal text field? We've had a lot of trouble with the keyword field in InfoPath, and Designer. So, my first assumption is that it might have something to do with that field.

This SharePoint field does automatically place spaces between keywords. Is that an issue? Should there not be a space such as "Cashiering;Transfers"?


Gravatar for

Comment by timzavertnik, Feb 6, 2019 9:31 PM

What are the steps to apply this within Coveo Cloud v2? We are running into a similar issue where our content is tagged with values from our Term Store. Any help or direction is greatly appreciated. Thanks.

1 Reply
Gravatar for

Answer by fjalbert, Aug 28, 2017 7:14 PM

You can use a Post Conversion Script to remove unwanted characters.

Here's sample script to remove the "#" and rogue numbers.

Dim FieldValues, ArrayFieldValues, Value, NewFieldValues, Count
'Assigns the values of the you lookup column to the FieldValues varrible to remove the rogue numbers'
On Error Resume Next
FieldValues = DocumentInfo.GetFieldValue("MetadataName")
On Error Goto 0
'Checks to see if there is a value in FieldValues'
If FieldValues <> "" Then
    FieldValues = Replace(FieldValues, "#", "")
    ArrayFieldValues = Split(FieldValues, ";", -1, 1)
    NewFieldValues = ""
    Count = 0
    'Loops through the split values to check them to see if they are only a numeric value'
    For Each Value in ArrayFieldValues
        'Checks to see if the vlaue is numeric.  If it is not numeric it is added to the NewFieldValues varrible'
        If (IsNumeric(Value) = False) then
            'Checks to see if it is the first loop through.  If it is no ";" is added'
            If Count = 0 then
                NewFieldValues = NewFieldValues & Value
                NewFieldValues = NewFieldValues & ";" & Value
            End If
            Count = Count + 1
        End If
    'Assign the new value to the KBKeywords metadata'
    Call DocumentInfo.SetFieldValue("MetadataName",NewFieldValues)
End If

If you need Help on adding conversion scripts in CES7, you will find more information here:

Ask a question