> To build or manage a Wix site with an AI agent, follow https://www.wix.com/headless/skill.md
> It builds a new Wix site or puts your own site online, from a prompt, and keeps changing it afterwards. The pages are code in any web technology, and Wix runs the backend.
> It works through the Wix plugin (the Wix MCP and the Wix skills), the Wix CLI or no Wix login, and puts the site live on Wix hosting or on another host.
> Business features include a store, bookings, events and tickets, a restaurant, a blog, forms, members and many more.
> Read the Wix skills online at https://www.wix.com/skills
> 
> Portal Navigation:
> 
> - Append `.md` to any URL under `https://dev.wix.com/docs/` to get its markdown version.
> - Pages are either content pages (article or reference text) or menu pages (a list of links to child pages).
> - To get a menu page, truncate any URL to a parent path and append `.md` (e.g. `https://dev.wix.com/docs/sdk.md`, `https://dev.wix.com/docs/sdk/core-modules.md`).
> - If a reference page seems to be missing its schema (parameters, return types, or type definitions), append `?schema=true` to its `.md` URL (e.g. `https://dev.wix.com/docs/contexts/contexts/stores/category-info/use-category-info-context.md?schema=true`).
> - Top-level index of all portals: https://dev.wix.com/docs/llms.txt
> - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt

## Resource: Sample Flows

## Article: Sample Flows

## Article Link: https://dev.wix.com/docs/api-reference/business-solutions/cms/collection-management/indexes/sample-flows.md

## Article Content:

# Indexes API: Sample Use Case & Flow

This article presents a possible use case and corresponding sample flow that you can support. This can be a helpful starting point as you plan your implementation.

## Optimize query performance with multiple indexes

You can improve the performance of queries on a large tutorials collection by creating indexes for commonly filtered and sorted fields. This ensures that user-facing queries (such as filtering by category and sorting by publish date) return results quickly, even as the collection grows to hundreds of tutorials.

To create indexes for tutorials in a collection:

1. Call [Create Index](https://dev.wix.com/docs/api-reference/business-solutions/cms/collection-management/indexes/create-index.md). Specify values for `name`, `fields.path`, and `fields.order`.

    For example, to optimize queries by category in alphabetical order and most recent date published, you might specify an index as follows:
    ```
    "index": {
      "name": "category-recent",
      "fields": [
        {
          "path": "category",
          "order": "ASC"
        },
        {
          "path": "publish-date",
          "order": "DESC"
        }
      ]
    }
    ```

2. Call [Create Index](https://dev.wix.com/docs/api-reference/business-solutions/cms/collection-management/indexes/create-index.md) again to create a unique index on slug to enforce unique tutorial URL slugs and accelerate slug lookups. Specify values for `name` and `fields.path`. To prevent duplicate slug values in the collection, set the value of `unique` to `true`.

    For example, to optimize queries for tutorials by category in alphabetical order and most recent date published, you might specify an index as follows:
    ```
    "index": {
      "name": "slugs-lookup",
      "fields": [
        {
          "path": "slugs"
        }
      ],
      "unique": false
    }
    ```

To monitor index creation status:

1. Call [List Indexes](https://dev.wix.com/docs/api-reference/business-solutions/cms/collection-management/indexes/list-indexes.md) to retrieve all indexes for the collection.

2. Check each index's `status` field. When `status` is `ACTIVE`, the index is ready to use. While `status` is `BUILDING`, index creation is still in progress.