Table of Contents
MageStack natively supports Sphinx, in order to take advantage of it, you need to do 2 things,
- Enable Sphinx for the
vhost
(contact a member of the support team to do this) - Ensure that you have placed the Sphinx configuration files in the correct directory (see below)
Sphinx Configuration Details
Hostname: sphinx1.i
Port: 9315
SphinxQL Configuration Details
Hostname: sphinx1.i
Port: 9316
Sphinx configuration file locations
! Your configuration file is usually generated by your Extension, please refer to the extensions documentation for instructions on how to do this.
There are 3 main configuration files we observe when building a Sphinx core for your vhost
The following directory must exist (adjust example.com to suit),
/microcloud/domains/example/domains/example.com/http/lib/Sphinx
Then within that, the following configuration files are valid,
wordforms.txt
stopwords.txt
synonyms.txt
sphinx.conf
Once you have added/updated these files, we can (re-)build your Sphinx core.
Default Sphinx configuration
! This configuration should only be used if you are developing your own extension that utilizes Sphinx
If you haven't specified your own Sphinx configuration, we use the following defaults (as is used on the example.com
demo store on MageStack), the fields
source magento_examplecom {
type = mysql
sql_host = %%DBHOST%%
sql_user = %%DBUSER%%
sql_pass = %%DBPASS%%
sql_db = %%DBNAME%%
sql_port = 3306
sql_sock = /var/lib/mysql/mysql.sock
sql_query_pre = SET NAMES utf8;
sql_query = SELECT CONCAT(product_id, store_id) AS id, catalogsearch_fulltext.* FROM catalogsearch_fulltext
sql_attr_uint = product_id
sql_attr_uint = store_id
}
index examplecom {
source = magento_examplecom
path = %%SPHINXDIR%%/sphinx.index
morphology = stem_en, metaphone
min_word_len = 1
charset_type = utf-8
blend_chars = -
blend_mode = trim_both
html_strip = 1
stopwords = /microcloud/data/mysql/sphinx/examplecom/stopwords.txt
exceptions = /microcloud/data/mysql/sphinx/examplecom/synonyms.txt
wordforms = /microcloud/data/mysql/sphinx/examplecom/wordforms.txt
}
Using Variables in Configuration file
There are a number of pre-defined variables so that you can use to make management easier, they should be wrapped in %%
characters as shown:
%%DBHOST%%
- The database host (as stored in yourlocal.xml
)%%DBNAME%%
- The database name (as stored in yourlocal.xml
)%%DBUSER%%
- The database username (as stored in yourlocal.xml
)%%DBPASS%%
- The database password (as stored in yourlocal.xml
)%%CLEANTLD%%
- This is thevhost
domain name, with all nona-zA-Z0-9
characters removed (Eg.examplecom
)%%INDEX_NAME%%
- Same as theCLEANTLD
variable%%GROUP%%
- The domain group name (eg.example
)%%TLD%%
- Thevhost
top level domain, as defined in its directory path (eg.example.com
)%%SPHINXDIR%%
- This is the path to the Sphinx index, it is automatically populated based on the index name (eg.examplecom
)