Optimization Rules Editor
Table of Contents
- What rules are and how they work (processing pipeline)
- Rule types — transformation actions
- Conditions — when a rule applies (if/then)
- Regular expressions and text functions
- Rule order — why it matters
- Creating a rule — step by step
- Testing a rule on a product sample
- Enabling and disabling rules
- Copying rules between feeds
What rules are and how they work (processing pipeline)
Rules are instructions that Sembot executes on product data after fetching the source file and before generating the output file. They allow you to modify, enrich, filter, and transform product attributes without touching the store or the source file.
Example use cases:
- Add the brand at the beginning of every product title if the title doesn't already contain it
- Replace all prices in the "Sale" category with a price reduced by 20%
- Exclude from the output file any products without an image or with a price below $5
- Replace the abbreviation "pcs." with "pieces" in all descriptions
Rules run sequentially — one after another, in a set order. The output of one rule becomes the input for the next. Sembot visualizes this on the Rules page with the following layout:
Input product
↓
Rule no. 1
↓
Rule no. 2
↓
Rule no. 3
↓
Output productInformation displayed in the interface: "The content of the product table is the result of established rules. Rules operate dependently. This means that the output of one rule can be used in the filter of the next rule."
To access rules, select a project and then click Rule Settings in the left menu.
Rule types — transformation actions
Sembot does not have rigid "rule types" — every rule follows the same schema: conditions (filters) + action (what to do with the attribute). The type of transformation is determined by the selected action. Below is a summary of available actions grouped by use case.
Text — field content modification
| Action | What it does |
|---|---|
| overwrite | Replaces the entire field value with the specified text |
| Replace | Searches for the specified text in the field and replaces it with other text |
| Replace with regular expression | Like "Replace", but the search pattern is a regular expression (regex) |
| prepend | Adds text before the existing field value |
| append | Adds text after the existing field value |
| set empty | Clears the field value (sets it to empty) |
| Replace uppercase letters | Searches for words written in ALL CAPS and replaces them with the specified value |
Text — letter case changes
| Action | Effect |
|---|---|
| Default font | First letter uppercase, remaining lowercase |
| Title Case | First letter of each word uppercase |
| lowercase | Entire text in lowercase |
| UPPERCASE | Entire text in uppercase |
Numeric — mathematical operations
| Action | What it does |
|---|---|
| add | Adds the specified number to the field value |
| subtract | Subtracts the specified number from the field value |
| multiply | Multiplies the field value by the specified factor |
| divide | Divides the field value by the specified divisor |
Numeric actions are useful for automatically calculating margins, converting prices between markets, or rounding values.
Advanced — building new values
| Action | What it does |
|---|---|
| generate value | Builds a new field value by concatenating several other attributes and arbitrary text |
| add value found in field | Searches for a value in one field and copies it to another |
| multiple search | Searches for multiple patterns simultaneously — useful for bulk dictionary replacements |
| Modify link | Adds, removes, or modifies parameters in a URL (e.g., UTM parameters) |
| Set main image | Sets the product's main image to the image at the selected position (first, last, or at a specified index) |
Conditions — when a rule applies (if/then)
Each rule can have a set of conditions (filters) that determine which products it will be applied to. If a product does not meet the conditions — the rule skips it.
Logic:
- Without conditions — the rule applies to all products
- With conditions — the rule applies only to products that meet all (or any) of the conditions
Logical operators between conditions
| Operator | Meaning |
|---|---|
| and | The product must meet ALL conditions simultaneously |
| or | It is sufficient for the product to meet ONE of the conditions |
Conditions can be grouped — each group has its own logical operator, and groups are connected by another operator. This provides full flexibility for building complex criteria.
Available condition operators
For text fields
| Operator | Meaning |
|---|---|
| Is empty | The field has no value |
| is not empty | The field has any value |
| equals | The field value exactly matches the specified text |
| Contains | The field contains the specified string (anywhere) |
| Does not contain | The field does not contain the specified string |
| starts with | The field value begins with the specified text |
| ends with | The field value ends with the specified text |
| Contains one of the values | The field contains at least one of the specified values |
| Exists in | The field value belongs to the specified list of values |
| Does not exist in | The field value does not belong to the specified list of values |
| regexp | The field value matches the regular expression |
| CAPSLOCK used | The field value is written in uppercase letters |
| contains manual changes | The product was manually edited in Sembot |
For numeric fields
| Operator | Meaning |
|---|---|
| = | Number equal to the specified value |
| > | Number greater than the specified value |
| >= | Number greater than or equal to the specified value |
| < | Number less than the specified value |
| <= | Number less than or equal to the specified value |
| Top N | N products with the highest value (e.g., 10 most expensive) |
| Bottom N | N products with the lowest value (e.g., 10 cheapest); max. 1000 products |
Regular expressions and text functions
The Replace with regular expression action and the regexp condition operator allow you to use regular expressions (regex) for precise pattern matching in text.
Regular expressions are useful when:
- You want to remove all numbers from a product title
- You want to find products whose EAN has an invalid format (not 13 digits)
- You want to replace any text in parentheses with an empty string
- You want to match a product code pattern (e.g.,
[A-Z]{2}\d{4})
The regex field does not have a built-in tester — it is recommended to test the pattern first in an external tool (e.g., regex101.com), then paste the finished expression into the form.
Additional options for text actions
The Replace and Replace with regular expression actions have options to refine their behavior:
| Option | What it does |
|---|---|
| match case | Distinguishes letter case — "Nike" and "nike" are different patterns |
| Full word match | Matches only whole words, not fragments of words |
The Modify link action has these options:
| Option | What it does |
|---|---|
| Add parameter | Adds a new parameter to the URL (e.g., ?utm_source=sembot) |
| Remove parameter | Removes the specified parameter from the URL |
| Skip existing | Does not overwrite a parameter if it already exists in the URL |
Rule order — why it matters
Rules are executed in order from top to bottom — rule no. 1 first, rule no. 2 on its output, and so on. Order is critical because each rule "sees" data already processed by the previous ones.
Example of order impact:
You have two rules:
- Prepend to title:
"Nike — " - Replace in title:
"Nike"→"NIKE"
If rule 1 is before rule 2: title "Sports shoes" → "Nike — Sports shoes" → "NIKE — Sports shoes" ✓
If rule 2 is before rule 1: title "Sports shoes" → "Sports shoes" (no "Nike" word, so nothing changes) → "Nike — Sports shoes" (word "Nike" added, but not NIKE) ✗
Changing rule order
On the rules list, each row has a drag handle (icon on the left side). Grab the row and drag it to the target position — Sembot will automatically save the new order. The sequence number in the left column updates in real time.
Creating a rule — step by step
Click Add rule on the Rule Settings page. A two-step wizard will open.
Step 1 — Set filters
In this step you specify which products the rule applies to. On the right side of the form, a product table updates in real time — it shows only the products that currently meet the set conditions. This is a built-in live preview.
How to use the preview:
- Add a condition by clicking Add filter
- Select a product field (e.g.,
brand,price,title), operator (e.g., Contains), and value (e.g.,"Nike") - The table on the right immediately filters and shows products matching the condition
- Check whether the product list matches expectations — if not, adjust the conditions
Above the table, quick text filters are available: Search by title, Search by brand, Search by product type, Search by parent ID — these help quickly find specific products in the preview.
If you want the rule to apply to all products, skip the filters and click Next step right away.
Step 2 — Set actions
In this step you specify what should happen to the product attribute. Select:
- Target field — which product attribute should be changed (e.g.,
title,price,description) - Action type — what to do with that attribute (e.g., prepend, Replace, multiply)
- Value — the action parameter (e.g., text to add, number to multiply by, pattern to replace)
After filling in the details, click Save — the rule will appear on the list and be activated.
Testing a rule on a product sample
Sembot does not have a separate "Test rule" button — testing happens through the real-time preview while creating a rule.
In step 1 (Set filters): the product table on the right shows in real time which products meet the set conditions. You can assess whether the rule's scope is correct — for example, whether it covers 200 products instead of all 5,000.
After saving the rule: the rules list on the Rule Settings page shows a condensed definition of each rule — conditions in the Filters column and the action in the Actions column. Clicking Show more on the filters expands the full list of conditions.
Verifying the effect: after saving the rule, its result is visible in the product table — go to Your products, find a product covered by the rule, and check the attribute values.
Enabling and disabling rules
Each rule on the list has an activity toggle (left column). A disabled rule is skipped during processing — products pass through it unchanged. Disabling does not delete the rule or its configuration.
- Clicking the toggle → Rule has been enabled or Rule has been disabled
- If a rule contains a configuration error, it cannot be enabled: "The rule contains an error and cannot be enabled."
Disabled rules are displayed with gray text in the list.
Copying rules between feeds
Sembot does not have a "Copy rule to another project" button in the interface. Alternative methods for transferring rules:
Rule templates — ready-made rule sets for common scenarios that can be applied to any project with a single click. Click Browse templates on the Rules page.
Templates are divided into categories:
| Category | Use case |
|---|---|
| Cleaning | Removing unnecessary characters, spaces, abbreviations |
| Enrichment | Filling in missing attributes from other fields |
| SEO | Optimizing titles and descriptions for search engines |
| Quality | Verifying and improving data completeness |
| Compliance | Adapting to advertising channel requirements |
| Labels | Tagging products according to criteria |
| Exclusions | Filtering out products that don't meet criteria |
| Seasonal | Rules active in a specific time context |
Templates can be filtered by category, integration (e.g., Google Merchant Center), and searched by name. The number of results is displayed as "X templates".
After selecting a template, click Use template — the rule will be applied to the current project with the option to customize it before saving.
AI rule generation — the Generate with AI button on the templates page lets you generate a set of rules tailored to the project. Generated rules go to the Review generated rules screen, where you can review them, edit the order, remove unnecessary ones, and choose whether to save them as active (Save and activate) or as drafts (Save as draft).