---
title: Setting Up Semantic (Neural) Search with PIM
slug: user-documentation/setting-up-semantic-neural-search-with-pim
docTags: 
createdAt: 2025-02-17T08:10:00.462Z
---

## Prerequisites

Before enabling neural search, ensure you have:

- Access to the [Product Information Management](https://docs.nochannel.io/user-documentation) system
- Appropriate API credentials
- Required permissions for attribute management

## Step 1: Create Required Attributes

Create Neural Description Attribute:

:::CodeblockTabs
curl

```curl
curl --location 'https://api.upstartcommerce.com/pim/attributes' \
--header 'x-upstart-tenant: TENANT_ID'  \
--header 'x-upstart-site:SITE_ID' \
--header 'Content-Type: application/json' \
--header 'x-upstart-api-key: API_KEY' \
--data '{

    "name": "neural_description",
    "typeName": "String",
    "searchProperties": {
        "knnVectorSupported": true,
        "indexed": false,
        "knnVectorEmbeddings": {
            "semantic_catalog_model": {
                "dimension": 384,
                "method": {
                    "name": "hnsw",
                    "space_type": "l2",
                    "engine": "faiss"
                }
            }
        }
    }
    // ... additional configuration
}'
```
:::

### Create Neural Name Attribute

Similar configuration as above, but with "name" as the attribute name.

## Step 2: Commit Attributes

```curl
curl --location 'https://api.upstartcommerce.com/pim/batch/attributes/change-status' \
--header 'x-upstart-tenant: TENANT_ID' \
--header 'x-upstart-site: SITE_ID' \
--header 'Content-Type: application/json' \
--header 'x-upstart-api-key: API_KEY' \
--data '[

    {
        "id": "NEURAL_DESCRIPTION_ATTRIBUTE_ID",
        "status": "COMMIT"
    },
    {
        "id": "NAME_ATTRIBUTE_ID"
        "status": "COMMIT"
    }
]'
```

## Step 3: Create Product Template (screenshots will be added in the published doc)

1\. Upon logging in to the UpStart Commerce portal, navigate to PIM on the left navigation and select **Product Templates**.&#x20;

![](https://api.archbee.com/api/optimize/Yc_G-eLlbuN1stqxAdHsJ/8mmuFrgNevVL0PbSbOPMh_image.png)

2\. Click on the **+Create Template&#x20;**&#x62;utton and enter the template name and description.&#x20;

::Image[]{src="https://api.archbee.com/api/optimize/Yc_G-eLlbuN1stqxAdHsJ/2ILUEj7B0EorPJflHY5Ks_image.png" size="62" width="947" height="753" position="center" showCaption="false"}

3\. Scroll down in the Create Product Template pop-up and select the **Product Type**.

::Image[]{src="https://api.archbee.com/api/optimize/Yc_G-eLlbuN1stqxAdHsJ/Yr02m3R5D9GnMuvMTUulX_image.png" size="62" width="872" height="758" position="center" showCaption="false"}

4\. Once all the details are added, click on **Create & Open.**

5\. From the Attributes list, search for Neural/Semantic attributes and select all that are applicable.&#x20;

::Image[]{src="https://api.archbee.com/api/optimize/Yc_G-eLlbuN1stqxAdHsJ/OXwjrknlQaorMt6k-YIpM_image.png" size="88" width="1887" height="761" position="center" showCaption="false"}

6\. Once selected, click on the **Add&#x20;**&#x62;utton to add the Neural Search attribute to the template.

::Image[]{src="https://api.archbee.com/api/optimize/Yc_G-eLlbuN1stqxAdHsJ/2SfTjrm3aKneg3-mJRj6j_image.png" size="88" width="1877" height="760" position="center" showCaption="false"}

7\. Once added, the attribute will be shown under the Added Attributes section.&#x20;

::Image[]{src="https://api.archbee.com/api/optimize/Yc_G-eLlbuN1stqxAdHsJ/_RH4gyUdrICKerTq_Mx1D_image.png" size="88" width="1590" height="761" position="center" showCaption="false"}

8\. Click on the **Publish&#x20;**&#x62;utton to publish the product template.

:::hint{type="info"}
For a detailed guide on how to create a product template, go to [Product Templates](docId:3IvOQV3bkRkg-XW876aSh). a&#x20;
:::

## Step 4: Update Catalog Route

The catalog route needs to be updated to optimize the retrieval of KNN vectors. This step is crucial because it prevents the system from retrieving KNN vectors on every search request, which would be inefficient.

```curl
curl --location --request PATCH 'https://api.upstartcommerce.com/v1/search/routes/catalog_location_live' \
--header 'X-Upstart-Tenant: TENANT_ID' \
--header 'x-upstart-api-key: API_KEY' \
--header 'Content-Type: application/json' \
--data '{

    "indexes": [
        {
            "id": "catalog_location_live",
            "queryPipeline": "cataloglocationlive",
            "defaultPayload": {
                "search": {
                    "_source": {
                        "excludes": [
                            "dynamicProperties.neural_description_semantic_catalog_model_embedding",
                            "dynamicProperties.name_semantic_catalog_model_embedding"
                        ]
                    }
                }
            }
        }
    ]
}'
```

**Important Notes about KNN Vectors:**

1. The `excludes` field in the payload specifically excludes the KNN vector fields (`neural_description_semantic_catalog_model_embedding` and `name_semantic_catalog_model_embedding`).
2. This exclusion is important because:
   - KNN vectors are large data structures that aren't needed in the search response
   - Retrieving them with every search would increase response time and bandwidth usage
   - The vectors are only needed for the internal neural search computation
3. The vector embeddings are still used in the search process, but they're not returned in the response payload
4. Once the ML model and index are set up, these vectors will be automatically generated and stored for:
   - Every new product created
   - Any existing product that gets updated
   - The fields you've designated for neural search (name and description in this case)

## Step 5: Final Setup

Contact the UpStart Commerce team to reindex your catalog indexes to complete the Neural Search setup.
