> ## Documentation Index
> Fetch the complete documentation index at: https://doc.lucidworks.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Rules

export const LwTemplate = ({title = "Key questions to get you started", icon = "sparkles", cta = "Powered by Agent Studio", linkHref = "https://lucidworks.com/demo/?utm_source=docs&utm_medium=referral&utm_campaign=docs_cta_ai"}) => {
  const [isLoaded, setIsLoaded] = useState(false);
  useEffect(() => {
    const timer = setTimeout(() => {
      setIsLoaded(true);
    }, 500);
    return () => clearTimeout(timer);
  }, []);
  return <div className="lw-template-container">
      <Card title={title} icon={icon}>
        {isLoaded && <span dangerouslySetInnerHTML={{
    __html: `<lw-template id="a029c1a9-28be-427e-b0e1-5d918920246a"></lw-template
            >`
  }} />}
        <Link href={linkHref} className="agent-studio-link text-left text-gray-600 gap-2 dark:text-gray-400 text-sm font-medium flex flex-row items-center hover:text-primary dark:hover:text-primary-light group-hover:text-primary group-hover:dark:text-primary-light">Powered by Lucidworks Agent Studio</Link>
      </Card>
    </div>;
};

[old doc.lw link]: https//doc.lucidworks.com/fusion/5.9/mt9mtl

[localhost link]: http://localhost:3000/docs/5/fusion/operations/config-sync/objects/rules

[mintlify link]: https://doc.lucidworks.com/docs/5/fusion/operations/config-sync/objects/rules

ConfigSync treats rule collections distinctively, aligning more with configurations than data, due to their integral role in the operational logic of Fusion applications.
This unique approach to handling rule collections is outlined below, emphasizing their storage, synchronization, and selective inclusion criteria.

<LwTemplate />

## Storage location

Rule collections are strategically stored within the `_lw_system/collections-data` repository folder.
This placement underscores the perception of rules as configurations pivotal to the Fusion ecosystem, necessitating careful version control and management.

## Format

Rule collections are stored as JSON lines files, a format that is conducive to version control and change tracking.
This format ensures that rule configurations are stored in a human-readable and version-friendly manner, facilitating collaboration and change management.

## Periodic change capture

ConfigSync actively monitors and captures changes to rule collections at 60-minute intervals, a frequency that is configurable.
This ensures that any modifications are promptly recorded, maintaining an up-to-date configuration state.

## Handling of specific rule collections

### `_query_rewrite` collections

Collections named with the `_query_rewrite` suffix are stored in their entirety.
This means all associated data within these collections is preserved in ConfigSync, providing a comprehensive snapshot of the rule configurations.

### `_query_rewrite_staging` collections

Staging collections, identified by the `_query_rewrite_staging` suffix, undergo a selective storage process.

Only records marked as deployed (filtered by `deployed:true`) are stored.
This selective inclusion is strategic, addressing the potential for these staging collections to amass significant volumes of data, possibly spanning several gigabytes.
Storing such vast amounts of data, especially on platforms like GitHub, could be impractical, even when leveraging Large File Storage ([Git Large File Storage](https://git-lfs.com/)) capabilities for rules.

### Commerce Studio collections

Collections with the `_em` suffix are automatically created when Commerce Studio is enabled for an application.

These collections follow the naming pattern `<app_name>_query_rewrite_em` and contain Commerce Studio configuration data. Starting with Fusion 5.17.0, ConfigSync automatically backs up these collections in their entirety, similar to standard `_query_rewrite` collections.
