Search Shell Commands

Our Search Sphinx extension also have a command-line interface, which can be used from console or SSH.

Here is the list of available commands. (for bin/magento):

Managing Search Sphinx from console

Console management of Search Sphinx includes the following commands:

  • start - starts Search Daemon
  • stop - stops Search Daemon
  • restart - kills Search Daemon process and starts it with clean data
  • reset - cleans search temporary data
  • status - displays current status of Search Sphinx engine.
  • ensure - special command, which automatically checks status, and only if daemon do not work, start it up.

To execute management command, run the following expression from console/SSH:

    bin/magento mirasvit:search-sphinx:manage --[command]

Running Reindex from console

Console reindexing can be run either for a whole store (without mode options), or for a selected Index (see more at Managing Indices), and for selected Store.

    mirasvit:search:reindex --[mode]=[argument]

Possible modes are:

  • INDEX - allows to reindex particular index. [argument] value should be code if desired index.
  • STORE - allows to reindex all indices at particular store. [argument] value should be code if desired store. Store codes can be seen in Stores -> All Stores in Magento 2 backend.

Tip

Possible codes of indices you can get directly at console by executing command

mirasvit:search:reindex --index=default

This command will display all indexes with codes in square brackets.

Modes can be used simultaneously, e. q. if you need to reindex Product index (code is 'catalogsearch_fullindex') on store with code 'german', you need the following command:

    mirasvit:search:reindex --index=catalogsearch_fullindex --store=german

Managing Stopwords from console

Console stopword managing allows you not only to import, but also to remove stopwords. For that you will need the following command:

    mirasvit:search:stopword [arguments]

Possible arguments are:

  • --file - defines, which YAML file will be used for stopwords importing.
  • --remove - optional argument, that commands to remove stopwords instead of importing. Requires previous argument.
  • --store=[store_code] - required argument, that forces import/remove action performing only on specific store. Store codes can be seen in Stores -> All Stores in Magento 2 backend.

Format of YAML file, which is used for managing stopwords, can be seen here.

Managing Synonyms from console

Console synonym managing allows you not only to import, but also to remove them. For that you will need the following command:

    mirasvit:search:synonym [arguments]

Possible arguments are:

  • --file - defines, which YAML file will be used for synonyms importing.
  • --remove - optional argument, that commands to remove synonyms instead of importing. Requires previous argument.
  • --store=[store_code] - required argument, that forces import/remove action performing only on specific store. Store codes can be seen in Stores -> All Stores in Magento 2 backend.

Format of YAML file, which is used for managing synonyms, can be seen here.