Gravatar for

Question by timzavertnik, Feb 7, 2019 4:41 PM

Multi-Value Facet - SharePoint Enterprise Keywords - Coveo Cloud v2

I am running into a similar issue that was posted in this question:

An answer was given for the CES 7 version but we are using Coveo Cloud v2. What would be the approach to solve this on that version?

Gravatar for

Comment by timzavertnik, Feb 7, 2019 7:00 PM

@Jean-François L'Heureux as you requested. Any help or direction that you can provide will be greatly appreciated. Thanks.

2 Replies
Gravatar for

Answer by timzavertnik, Feb 18, 2019 8:55 PM

For anyone else that runs into this issue, this is how we resolved it. Below is the Python code that goes within the extension to parse the terms. Make sure you run the extension as a post-conversion.

def get_flattened_meta():
    flattened = dict()
    for m in document.get_meta_data():
        for metadata_name, metadata_values in m.values.iteritems():
            flattened[metadata_name.lower()] = metadata_values
    normalized = dict()
    for metadata_name, metadata_values in flattened.iteritems():
        if len(metadata_values) == 1:
            normalized[metadata_name] = metadata_values[0]
        elif len(metadata_values) > 1:
            normalized[metadata_name] = ";".join([str(value) for value in metadata_values])
    return normalized
def clean_multi_value_facet(field_values):
    newFieldValue = ""
    fieldValue = field_values
    fieldValue = fieldValue.replace("#","")
    fieldArray = fieldValue.split(";")
    for i in range(len(fieldArray)):
        if(str(fieldArray[i].isdigit()) == "False"):
            if(i == 0):
                newFieldValue = grab_label(fieldArray[i])
                newFieldValue = newFieldValue+";"+grab_label(fieldArray[i])
    return newFieldValue
def grab_label(field_value):
    newLabelValue = ""
    labelArray = field_value.split("|")
    for i in range(len(labelArray)):
            newLabelValue = labelArray[i]
    return newLabelValue
meta_data = get_flattened_meta()
if "resourcetype" in meta_data:    
Gravatar for

Answer by Jean-François L'Heureux, Feb 11, 2019 4:03 PM

With Coveo Cloud V2, pre and post conversion scripts are now called "Indexing pipeline extensions". They are Python scripts instead of jScript, VBScript, or .Net.

You can find the documentation on these pages and subpages:



It is your role to convert the CES7 VBScript sample script of the referenced question to Python.

Ask a question