Applying an Extension to a Source

An extension is essentially a Python script that you add to your organization to customize the way source items are included in your organization (see Indexing Pipeline Extension Overview).

Once an indexing pipeline extension is available in your organization, from the Coveo Cloud V2 administration console, you can easily apply the extension to a source so that it is executed for source items going through the indexing pipeline (see Coveo Cloud V2 Indexing Pipeline).

To apply an extension to a source

  1. If not already done, log in to the Coveo Cloud V2 administration console with a user that is a member of a group with the required privileges to manage extensions (see Required Privileges).

  2. Ensure your extension is available in your Coveo Cloud V2 organization (see Add/Edit an Extension - Panel).

  3. Select the source to which you want to apply an extension:

    1. In the main menu on the left, under Content, select Sources.

    2. In the Sources page, select the source.

  4. Go to the Edit Source Extensions: [Source_Name] panel:

    On the Action bar, select More > manage extensions.

  5. In the Edit Source Extensions: [Source_Name] panel:

    An extension is Common when it must be executed for all items of a source and Specific when it is executed only for one or more source item types (see Source Item Types).

    Apply an extension only to applicable source item types to minimize indexing time.

    1. If you want to apply an extension conditionally only to one or more specific source item types, you must first ensure the item type is defined:

      1. Click the Specific tab.

      2. Verify that the desired item type appears in the Item type list (there are none by default).

        If it is not defined:

        1. In the upper-right corner, click Add > Item type.

        2. In the Add an Item Type panel, enter the value for the item type to which you want the extension to be applied (see Finding the Source Item Type Values), and then click Add.

        3. If applicable, repeat for other missing item types.

    2. Apply an extension to the source:

      1. In the upper-right corner, click Add > Extension.

      2. In the Add an Existing Extension on the Source Items panel:

        1. In the Extension drop-down menu, select the name of the extension that you want to apply to the source. Alternatively, click Add Extension to create a new extension (see Add/Edit an Extension - Panel). You can also select an extension, and then click Edit Extension to edit it.

        2. Under Stage, select Pre-Conversion or Post-Conversion to determine at what indexing pipeline stage the extension executes (see Coveo Cloud V2 Indexing Pipeline and Preconversion Versus Postconversion).

        3. Under Apply To:

          • Select All items (common) when you want to extension to be executed for all source items.

          OR

          1. Select Specific item types for a conditional extension execution, based on the source item type.

            Check boxes appear for each defined source item type.

            If you see No item types, you must first define them (see previous step).

          2. Select the check box of one or more item types to which you want the extension to apply.

        4. When the extension is relevant only to specific source items that cannot be filtered by their item types, the best practice to minimize indexing time is to set a condition determining to which items the extension applies.

          In the Condition(s) to be applied parameter, enter an expression respecting the condition syntax (see Indexing Pipeline Extension Condition Syntax Reference).

          You create an extension that looks for specific tags metadata values entered by end-users to determine how to populate a products metadata with normalized product name values. Running this extension when an item has no tags metadata values would waste resources and slow down indexing.

          You add the condition NOT @tags=='' that is true for an item only when its tags field is not empty.

        5. Click Add.

      The extension appears under the Common or Specific tab, depending on your selection.

    3. Click Save and Rebuild to save your configuration changes and to force all source items to go through the indexing pipeline and execute the extension.

      Click Save when you want to save extension configuration changes, but change some other source configuration or wait to a specific moment to rebuild your source.

  6. Validate that your extension script executed properly:

    1. Ensure that the extension executed without errors:

    2. Check if your script affected the items as expected, maybe using the Content Browser (see Content Browser - Page and Inspecting Items With the Content Browser).

    3. If your extension script writes error or troubleshooting logs, go to the administration console Log Browser page to look for those logs (see Log Browser).

You can use the JSON tab to inspect you source extension configuration and perform more advanced configuration (see Use Cases Requiring to Modify the Source Extension JSON Configuration).