Apply an Extension to a Source

An indexing pipeline extension is a Python script that you add to your Coveo organization that customizes the way you include source items in your organization.

Once an indexing pipeline is available in your organization, from the Coveo Administration Console, you can easily apply the extension to a source so that it’s run for source items which go through the indexing pipeline.

An extension can be Common, applying to all item types of a source, or Specific, applying only to specified item types, in which case you must first define the item types available in your source.

To apply an extension to a source:

  1. Log in to the Administration Console as a member of a group with the required privileges to manage extensions in the target organization, if not already done.

  2. Ensure that your extension is available in your organization. If required, you can edit your indexing pipeline extension.

  3. In the Content menu, select Sources. Then, select the source that you want to apply your extension to.

  4. In the Action bar, click More > Manage extensions.

  5. In the Add/Edit Source Extensions panel, select the Specific or Common tab, depending on which type of extension you would like to add.

    When applying a Specific extension, verify that the desired item types appear in the Item type list. If there are no item types listed, add the item type.

    To minimize indexing time, apply an extension only to applicable source item types.

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

  7. From the Extension drop-down menu, within the Apply an Extension on Source Items panel, select the name of the extension that you want to apply to the source.

  8. Under Stage, select Pre-Conversion or Post-Conversion to determine at what indexing pipeline stage the extension runs.

  9. Under Action on Error, select Reject Document to prevent the items from indexing if there’s an error in the extension, or select Skip Extension if you want to index the items regardless of an error.

    EXAMPLES
    • Your extension adds metadata to items for facets and filters that aren’t business-critical. Select Skip Extension to ensure that the items are indexed regardless. You can fix the issue afterward and then refresh the source.

    • The extension adds permissions to items or adds a field which will hide the items from a specific audience. Select Reject Document to ensure that the items don’t advance in the indexing pipeline so that no sensitive content is indexed.

  10. Under Apply to, select All items (common) to run the extension for all source items.

    If you only want it to run for particular source items, select Specific item types and then check the boxes of the desired item types.

    • If you see The source must contain at least one item type when selecting Specific item types, you must first define them.

  11. (Optional) In the Conditions to apply parameter, enter one or more expressions respecting the condition syntax.

    To minimize indexing time when the extension is relevant only to specific source items that can’t be filtered by their item types, you should set a condition determining to which items the extension applies.

    EXAMPLE

    You create an extension that seeks 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 decrease indexing speed.

    You add the condition NOT @tags=='' that’s true for an item only when its tags field isn’t empty.

  12. Click Add. The extension now appears under the Common or Specific tab, depending on your selection.

  13. Choose how you would like to save your changes:

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

    • Click Save when you want to make some other changes to the source configuration before rebuilding, or when you want to rebuild your source at a specific time in the future.

  14. Validate that your extension script ran properly:

    1. Ensure that the extension ran without errors by checking the Extensions page and, in particular, the Usage Statistics panel.

    2. Check whether your script affected the items as expected. For example, you can inspect items with the Content Browser.

    3. If your extension script writes error or troubleshooting logs, navigate to the Administration Console Log Browser page to find these logs.

You can use the JSON tab to inspect your source extension configuration and perform more advanced configurations.

Recommended Articles