Skip to main content

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:

OptionDescription
--index=catalogsearch_fulltextallows reindexing of a specific index. For example, to reindex only the Catalog Search index, use catalogsearch_fulltext.
--store=2allows 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
tip

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:

OptionDescription
--file=stopwords.csvdefines, which CSV file will be used for stopwords importing. Format of CSV file, which is used for managing stopwords, can be seen here.!!!!!!!!
--removethe command to remove stopwords instead of importing them. This requires the previous option.
--store=2required 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:

OptionDescription
--file=synonyms.csvdefines, which CSV file will be used for synonyms importing. Format of CSV file, which is used for managing synonyms, can be seen here.!!!!!!!!
--removethe command to remove synonyms instead of importing them. This requires the previous option.
--store=2required argument that forces the import/remove action to be performed only on a specific store (e.g., store ID=2).
note

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:

OptionDescription
--startstarts the Search Daemon.
--stopstops the Search Daemon.
--restartkills the Search Daemon process and starts it with clean data.
--resetclears temporary search data.
--statusdisplays current status of Search Sphinx engine.
--ensurespecial 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:

OptionDescription
--store-id=2store view to index. Vectors are stored per store view, so each one has to be indexed separately. Defaults to the default store view.
--limit=100processes only this many products. Useful for a trial run before indexing the whole catalog.
--skus=SKU1,SKU2processes only the listed SKUs.
--forcere-embeds every product, including those whose image and model have not changed. Without it, up-to-date products are skipped.
--recreatedrops the vector index and clears the stored vectors for the store view, then indexes from scratch.
--batch-size=25how 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.

warning

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:

OptionDescription
--recreatedrops and recreates the index before syncing. Use it to reset the index completely.
--batch-size=25how many rows are sent in each bulk request. Default value is 25.
note

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:

OptionDescription
--text="red shoes"optional hint passed to the vision model alongside the image, as a shopper could enter.
--store-id=2store view to search in. Defaults to the default store view.
--k=20how many nearest matches to return. Default value is 20.
--locale=en_USlocale used for the vision prompt. Default value is en_US.
note

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:

OptionDescription
--store-id=1processes only the specified store view. By default, every active store view is processed.
--skus=SKU1,SKU2processes only the listed SKUs.
--limit=100processes only this many products per store view.
--batch-size=25how many vectors are saved per database write, from 1 to 500. Default value is 25.
--forcere-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.

warning

This command calls the OpenAI API and counts towards the Monthly token budget. Store views whose budget is exhausted are skipped.