Sphinx and its configuration
The process of configuring Sphinx in a project, using CentOS 7.x as an example.
In other operating systems, the path to the Sphinx directory may be different.
-
Install Sphinx on the server.
The minimum recommended version is 2.2.11+.
-
In the project's admin panel, specify the connection parameters for Sphinx in the "Site Settings / System Settings / Others / Sphinx" section.
Host - 127.0.0.1 (default)
Port - 9306 (default)
Path - absolute path to the Sphinx data directory - /var/lib/sphinx/ (default)
Version - the version of Sphinx installed on the server
-
Run the console command to generate an up-to-date Sphinx configuration file.
cd /path/to/project/public_html/ php index.php bff=sphinx
After that, an up-to-date configuration file /config/sphinx.conf will be generated for your project.
This command needs to be executed again when accessing the database is changed.
-
Copy the contents of the configuration file /config/sphinx.conf.global to the system configuration file for Sphinx /etc/sphinx/sphinx.conf
In this file, specify the path to the /config/sphinx.conf file in your project in the
files
block, for example:files=( "/path/to/project/config/sphinx.conf" )
-
Check the correctness of indexing by executing the command:
indexer --all --rotate
-
Start the searchd service and make sure it will automatically start after server reboot.
-
Configure cron tasks for indexing:
For Classifieds they are as follows:
# Items: 4 3 * * * indexer itemsIndexMain --quiet --rotate 1-59/5 * * * * indexer itemsIndexDelta --quiet --rotate; indexer --merge itemsIndexMain itemsIndexDelta --rotate # Shops (if you use this module): 4 7 * * * indexer shopsIndexMain --quiet --rotate 2-59/5 * * * * indexer shopsIndexDelta --quiet --rotate; indexer --merge shopsIndexMain shopsIndexDelta --rotate
-
Enable the use of Sphinx in the relevant sections of "Site Settings / System Settings".