Command Line Interface
Below are the available commands for the Search Ultimate module.
Running Reindex from console
Console reindexing can be performed for the entire store (without mode options), a specific index (see Managing Indexes), or a chosen store.
bin/magento mirasvit:search:reindex
Possible options are:
| Option | Description |
|---|---|
| --index=catalogsearch_fulltext | allows reindexing of a specific index. For example, to reindex only the Catalog Search index, use catalogsearch_fulltext. |
| --store=2 | allows reindexing of all indices for the store with ID 2. |
You can get the possible index codes directly in the console by executing the following command:
bin/magento mirasvit:search:reindex --index=default
Command options can be combined:
bin/magento mirasvit:search:reindex --index=catalogsearch_fullindex --store=2
Managing Stopwords from console
Console stopword management allows you to import and remove stopwords. To remove stopwords, use the following command:
bin/magento mirasvit:search:stopword
Possible options are:
| Option | Description |
|---|---|
| --file=stopwords.csv | defines, which CSV file will be used for stopwords importing. Format of CSV file, which is used for managing stopwords, can be seen here.!!!!!!!! |
| --remove | the command to remove stopwords instead of importing them. This requires the previous option. |
| --store=2 | required argument that forces the import/remove action to be performed only on a specific store (e.g., store ID=2). |
Managing Synonyms from console
Console synonym management allows you to import and remove synonyms. To remove synonyms, use the following command:
bin/magento mirasvit:search:synonym
Possible options are:
| Option | Description |
|---|---|
| --file=synonyms.csv | defines, which CSV file will be used for synonyms importing. Format of CSV file, which is used for managing synonyms, can be seen here.!!!!!!!! |
| --remove | the command to remove synonyms instead of importing them. This requires the previous option. |
| --store=2 | required argument that forces the import/remove action to be performed only on a specific store (e.g., store ID=2). |
There is no console command to export synonyms or stopwords. To back them up or move them to another store, see Exporting synonyms and Exporting stopwords.
Managing Search Sphinx from console
bin/magento mirasvit:search-sphinx:manage
Console management of Search Sphinx includes the following commands:
| Option | Description |
|---|---|
| --start | starts the Search Daemon. |
| --stop | stops the Search Daemon. |
| --restart | kills the Search Daemon process and starts it with clean data. |
| --reset | clears temporary search data. |
| --status | displays current status of Search Sphinx engine. |
| --ensure | special command that automatically checks the status and starts the daemon only if it is not running. |
Building AI image search vectors from console
Generates the product vectors that AI image search matches uploaded photos against. Run it once per store view.
bin/magento mirasvit:search-ai:reindex
Possible options are:
| Option | Description |
|---|---|
| --store-id=2 | store view to index. Vectors are stored per store view, so each one has to be indexed separately. Defaults to the default store view. |
| --limit=100 | processes only this many products. Useful for a trial run before indexing the whole catalog. |
| --skus=SKU1,SKU2 | processes only the listed SKUs. |
| --force | re-embeds every product, including those whose image and model have not changed. Without it, up-to-date products are skipped. |
| --recreate | drops the vector index and clears the stored vectors for the store view, then indexes from scratch. |
| --batch-size=25 | how many products are sent in each bulk request. Default value is 25. |
The command reports the number of products to be processed and an estimate of the tokens involved, then asks for confirmation before making any paid API calls.
This command calls the OpenAI API and incurs cost. --recreate drops the shared vector index, which removes the vectors of all store views, so avoid it when indexing store views one after another — without it the command simply updates what is already there.
Rebuilding the AI image search index from console
Rebuilds the search engine vector index from the vectors already stored in the database. It makes no AI calls and therefore costs nothing. Use it when the dashboard shows a mismatch between Vectorized and Documents in index, for example after switching search engines or rebuilding a cluster.
bin/magento mirasvit:search-ai:sync
Possible options are:
| Option | Description |
|---|---|
| --recreate | drops and recreates the index before syncing. Use it to reset the index completely. |
| --batch-size=25 | how many rows are sent in each bulk request. Default value is 25. |
This command restores image search vectors only. To restore the AI semantic search vectors in the search engine, run bin/magento indexer:reindex catalogsearch_fulltext.
Testing an AI image search from console
Runs an image search against the vector index and prints the matches, without going through the storefront. Intended for troubleshooting.
bin/magento mirasvit:search-ai:search /path/to/image.jpg
Possible options are:
| Option | Description |
|---|---|
| --text="red shoes" | optional hint passed to the vision model alongside the image, as a shopper could enter. |
| --store-id=2 | store view to search in. Defaults to the default store view. |
| --k=20 | how many nearest matches to return. Default value is 20. |
| --locale=en_US | locale used for the vision prompt. Default value is en_US. |
This command calls the OpenAI API for the image you pass it, so each run costs a small number of tokens.
Building AI semantic search vectors from console
Generates the product text vectors used by AI semantic search. Products whose text has not changed since the last run are skipped without an API call.
bin/magento mirasvit:search-ai:embed-text
Possible options are:
| Option | Description |
|---|---|
| --store-id=1 | processes only the specified store view. By default, every active store view is processed. |
| --skus=SKU1,SKU2 | processes only the listed SKUs. |
| --limit=100 | processes only this many products per store view. |
| --batch-size=25 | how many vectors are saved per database write, from 1 to 500. Default value is 25. |
| --force | re-embeds every product, even if its text has not changed. |
After the command finishes, run bin/magento indexer:reindex catalogsearch_fulltext to send the vectors to the search engine.
This command calls the OpenAI API and counts towards the Monthly token budget. Store views whose budget is exhausted are skipped.