---
title: "Configure partial search"
slug: "configure-partial-search"
abstract: "How to configure Sitecore xConnect Search to use partial search on selected fields."
---
# Configure partial search

| Applies to | Apache Solr. |
| --- | --- |

Sitecore xConnect Search supports partial text search using the [Apache Solr Edge N-Gram Tokenizer](https://www.apache.org/dist/lucene/solr/ref-guide/apache-solr-ref-guide-8.1.pdf). An edge n-gram of the single word `Sitecore` with a minimum value of 2 and a maximum value of 4 produces the tokens `Si`, `Sit`, and `Site`. A similar edge n-gram of the two-word string `xConnect Search` produces the tokens `xC`, `xCo`, `xCon` and `Se`, `Sea`, `Sear`.

> [!important]
> You [modify a Solr schema](https://lucene.apache.org/solr/guide/8_3/schema-api.html#modify-the-schema) by sending a POST request containing a block of JSON formatted commands to the `https://<Apache Solr>/collection/schema/` endpoint of *both the active and the rebuild versions of the Solr core*. They are named `<core_name>` and `<core_name>_rebuild`.

## Add a partial text search field

The xConnect Search role comes preconfigured with partial search activated for the following Personal Information facet fields `personal.firstname`, `personal.middlename`, `personal.lastname`, and `emails.preferredemail.smtpaddress`.

To add a partial text search field:

1. Post the `<xConnect Search role>\App_data\solrcommands\10.0-or-later-schema-preparation.json` file to *both Solr cores*. You might get a 404 error, which is normal.
2. Open the `<xConnect Search role>\App_Data\solrcommands\schema.json` file.
3. Add a new `add-copy-field` command where the preconfigured fields are located. The `source` property must be the field that you want to activate partial search for, and the `dest` property must always be `textmatch`.

    ```csharp
    "add-copy-field": [{
      "source": "facets.personal.firstname_s",
      "dest": "textmatch"
    }]
    ```

    The `add-copy-field` section aggregates the necessary variations (edge n-gram tokens) of the source data into the `textmatch` field.

4. To avoid issues that can prevent later modifications of the Solr schema, add the `facets.personal.firstname_s` field to the `add-field` section:

    ```csharp
    "add-field": [{
      "name": "facets.personal.firstname_s ",
      "type": "lowercase",
      "stored": false,
      "indexed": true,
      "omitNorms": true
    }]
    ```

5. Save the `schema.json` file.
6. Post the `schema.json` file to *both Solr cores*.

## Modify an existing partial text search field

If you need to modify an existing partial text search field, you must first delete its original configuration.

To modify a partial text search field:

1. Post the `<xConnect Search role>\App_data\solrcommands\10.0-or-later-schema-preparation.json` file to both Solr cores. You might get a 404 error, which is normal.
2. Open the `<xConnect Search role>\App_Data\solrcommands\schema.json` file.
3. Before the `add-copy-field` command that modifies your partial text search field, insert a command to delete the original configuration:

    ```csharp
    "delete-copy-field": [{
      "source":"facets.personal.firstname_s",
      "dest":"textmatch"
    }]
    "delete-field": [{ "name": "facets.personal.firstname_s" }]
    ```

4. Save the `schema.json` file.
5. Post the `schema.json` file to *both Solr cores*.

## Optimize partial text search

The `textmatch` field is configured to be a multi valued `text_match` field type. See the `add-field` section of the `schema.json` file for the specific details.

You can optimize partial search in the `filters` section of the `text_match` field type configuration. The default values set the minimum n-gram size to `2` and the maximum size to `15`. The higher the range between the two numbers, the more index space is required.

To optimize partial text search:

1. Post the `<xConnect Search role>\App_data\solrcommands\10.0-or-later-schema-preparation.json` file to both Solr cores. You might get a 404 error, which is normal.
2. Open the `<xConnect Search role>\App_Data\solrcommands\schema.json` file.
3. Change the `minGramSize` and `maxGramSize` properties to your preferred values:

    ```csharp
    "filters": [
      { "class": "solr.LowerCaseFilterFactory" },
      {
        "class": "solr.EdgeNGramFilterFactory",
        "minGramSize": "2",
        "maxGramSize": "15",
        "preserveOriginal": "true"
      }
    ]
    ```

4. Save the `schema.json` file.
5. Post the `schema.json` file to *both Solr cores*.

## Disable partial text search

If you have no need for partial search, you can disable it and improve performance.

To disable partial text search:

1. Post the `<xConnect Search role>\App_data\solrcommands\10.0-or-later-schema-preparation.json` file to both Solr cores. You might get a 404 error, which is normal.
2. Open the `<xConnect Search role>\App_Data\solrcommands\schema.json` file.
3. Delete the preconfigured `add-copy-field` section from the `schema.json` file:

    ```csharp
    "add-copy-field": [
      {
        "source": "facets.personal.firstname_s",
        "dest": "textmatch"
      },
      {
        "source": "facets.personal.middlename_s",
        "dest": "textmatch"
      },
      {
        "source": "facets.personal.lastname_s",
        "dest": "textmatch"
      },
      {
        "source": "facets.emails.preferredemail.smtpaddress_s",
        "dest": "textmatch"
      }
    ]
    ```

4. Save the `schema.json` file.
5. Post the `schema.json` file to *both Solr cores*.