Sphinx Search Ultimate

User Manual, v. 2.2.8

Extension Installation

For extension installation you need to follow next steps:

  • Login to Magento backend.
  • Disable compilation for Magento 1.4+. To do this go to System > Tools > Compilations. If Compiler Status is Enabled, then disable the compilation by clicking the button Disable in the upper right corner. This step eliminates almost all potential problems. It's necessary since Magento uses cache heavily. After installation of extension, you can enable compilation again.
  • Backup your store database and web directory.
  • Download extension from your Personal Account.
  • Unzip the extension locally
  • Copy contents of the folder "step1" to the root directory of Magento store
  • Copy contents of the folder "step2" to the root directory of Magento store
  • If you use a custom template or theme you should copy following folders:
    - app/design/frontend/base/default/layout/ from extension package to the app/design/frontend/your_template/your_theme/layout/ of your store
    - app/design/frontend/base/default/template/ from extension package to the app/design/frontend/your_template/your_theme/template/ of your store
  • Completely clear the site cache. Go to System > Cache Management. Click button Flush Magento Cache.
  • If you want to clear the cache manually, you need to remove at the server a folder /var/cache.
  • Logout from Magento backend and login again.
  • If necessary adjust css styles to fit your store's frontend theme

Sphinx Search Ultimate Settings

Configuration of search indexes

Catalog Product Index

After installation, you first need to configure the search indexes. Go to System > Configuration > Mirasvit Extensions > Search Index

System > Configuration > Mirasvit Extensions > Search Index > Catalog Product Index

  • Title - title of search index (displayed in tab)
  • Attributes - for each searchable attribute you can set own weight. Different weights indicate the importance of each attribute for product relevancy
  • Include category names path to product search index - if option enabled, product will be found by category name too
  • Include product tags to search index - if option enabled, product will be found by tag name too

Catalog Category Index

System / Configuration / Search Index / Catalog Category Index

  • Enabled - if enabled, search index will be displayed in search results
  • Title - title of search index (displayed in tab)
  • Attributes - for each attribute you can set own weight. Different weights indicate the importance of each attribute for product relevancy. All attributes which have to search, to be chosen
  • Position - position tab to display

Wordpress Blog Index

If you would like to add wordpress blog to the search results, you have to enable this index and make some configuration. 

  • Enabled - if enabled, search index will be displayed in search results
  • Title - title of search index (displayed in the tab)
  • Attributes - for each attribute you can set own weight. Weights indicate the importance of each attribute for product relevancy. Please, choose all attributes, which you would like to use in search. 
  • Table Prefix - prefix for wordpress tables (eg. if in database table names is wp_posts, then prefix is "wp_")
  • Base Url  - full url to your posts, where {name} - is the post name. (http://example.com/blog/{name}.html)
  • Another Database - if wordpress is use another database then magento, you have to set this option to "Yes" and fill "Connection name"
  • Connection name - connectin name in file app/etc/local.xml
  • Position - position of tab to display in the search results.

How create connection to another database?

For create a new connection you should add following code to app/etc/local.xml after section </default_setup>

<wordpress>
    <connection>
        <host>{database host}</host>
        <username>{user name}</username>
        <password>{password}</password>
        <dbname>{database name}</dbname>
        <initStatements><![CDATA[SET NAMES utf8]]></initStatements>
        <model>mysql4</model>
        <type>pdo_mysql</type>
        <pdoType></pdoType>
        <active>1</active>
    </connection>
</wordpress>

Where "wordpress" is connection name.

Sphinx Search Configuration

General Settings

For configure search go to System > Configuration > Mirasvit Extensions > Sphinx Search

System / Configuration / Sphinx Search / General Settings

  • Full Reindex Cron Regular Expr - sets the frequency of full re-indexing. Set up the frequency in the format: * * * * *, where: * 1 * 2 * 3 * 4 * 5: 1 - minute, 2 - hour, 3 - day 4 - month, 5 - year
  • Delta Reindex Cron Regular Expr - sets the frequency of delta re-indexing (reindex only changes). Set up the frequency in the format: * * * * *, where: * 1 * 2 * 3 * 4 * 5: 1 - minute, 2 - hour, 3 - day 4 - month, 5 - year

Advanced Settings

System / Configuration / Sphinx Search / Advanced Settings

  • Match Mode - indicates where to search for a match. There are the following matching modes available:
    • Matches all query words
    • Matches any of the query words
    • Matches query as a phrase, requiring perfect match
    • Matches query as a boolean expression
    • Matches query as an expression in Sphinx internal query language - default mode
  • Sphinx Host - host where the Sphinx is running, the default setting should be left
  • Sphinx Port - uses any free port number, the default setting should be left
  • Sphinx Bin Path - path to Sphinx searchd deamon (leave it blank for default or find it using shell command "which searchd")
  • Stopwords stopwords are the words that will not be indexed. Typically you'd put most frequent words in the stopwords list because they do not add much value to search results
  • Synonyms - synonyms allow to map one or more tokens (including tokens with characters that would normally be excluded) to a single keyword

Manage Sphinx Deamon

Extension supports two types of search engines:

  • Built-in search engine
  • External search engine - option available if sphinx search engine founded on server

Search Autocomplete Configuration

Go to System > Configuration > Mirasvit Extensions > Search Autocomplete

Magento Search Autocomplete - General Settings

In the opened window, enter settings:

  • Minimum number of characters to search - Specifies the minimum number of characters after entering of which the autocomplete will start
  • The delay before start finding - action timeout of a user entering a search query. If during this time, the user does not perform any action, the module starts to show hints. The time is specified in milliseconds
  • Maximum number of results in the dropdown list - this field limits the number of results in the drop-down list
  • Tip in the search box - the text that a user sees in a search line of the site
  • Show Price - enables the display of prices of products in the dropdown list
  • Show Thumbnail - enables product image displaying in the dropdown list
  • Thumbnail size - the size of thumbnail (eg. 100x100, 50x70)
  • Show Short Description - enables display a brief description of the products in the dropdown list
  • Max length of short description - the field limits the length of a brief description
  • Categories - categories for display in search autocomplete dropdown. If empty, extension dispaly all enabled top level categories

Click Save Config to save all the changes.

Search Spell Correction Configuration

Go to: System > Configuration > Mirasvit Extensions > Search Spell Correction

In the opened window, you just need to run re-index words. During re-index process, extension will extract all words from your catalog and save these word to own table.

Magento Search Spell Correction

Extension Disabling

To temporary disable extension please follow the next steps:

  • Disable Compilation Mode (if enabled).
  • Rename the file "app/etc/modules/Mirasvit_[ExtensionName].xml" to "app/etc/modules/Mirasvit_[ExtensionName].xml.bak".
  • Login in to Magento back-end and refresh site cache (if enabled).

To uninstall extension please follow the next steps:

  • Disable Compilation Mode (if enabled).
  • Rename the file "app/etc/modules/Mirasvit_[ExtensionName].xml" to "app/etc/modules/Mirasvit_[ExtensionName].xml.bak".
  • Login in to Magento back-end and refresh site cache (if enabled).
  • Remove all the extension files of the extension from folder "app/code/local/Mirasvit/[ExtensionName]".
  • Remove templates and layouts files of extension from your theme folder. List of such files can be collected from files in the extension package.

Additionally

Sphinx Search Engine Installation

Extension supports two types of search engines:

  • Built-in search engine
  • External search engine (Sphinx) - more preferred if you have large number skus in catalog (> 10 000)

For using External search engine you need install Sphinx Search Engine

Download Sphinx

Download the latest stable version of the engine for your server from the developers website http://sphinxsearch.com/downloads/release/

Installation Sphinx for Linux

The following describes the installation process for Source tarball (tar.gz). If you do not install the Sphinx from the source, then you will need after installing the Sphinx server to install dependencies via the manager of OS packages.

Install Source tarball

Extract everything from the distribution tarball (haven't you already?) and go to the sphinx subdirectory. (We are using version sphinx-2.0.6-release here for the sake of example only; be sure to change this to a specific version you're using.)

$ tar xzvf sphinx-2.0.6-release.tar.gz
$ cd sphinx

Run the configuration program:

$ ./configure

There's a number of options to configure. The complete listing may be obtained by using --help switch. The most important ones are:

  • --prefix, which specifies where to install Sphinx; such as
  • --prefix=/usr/local/sphinx (all of the examples use this prefix)
  • --with-mysql, which specifies where to look for MySQL include and library files, if auto-detection fails;
  • --with-pgsql, which specifies where to look for PostgreSQL include and library files.

Build the binaries:

$ make

Install the binaries in the directory of your choice: (defaults to /usr/local/bin/ on *nix systems, but is overridden with configure --prefix)

$ make install

Setting up CRON Job

Cron jobs, or scheduled tasks, must be enabled in order for Magento to operate properly.

By default if you're running a UNIX operating system it should automatically recognize Magento's requests to use the CRON TAB service. Magento needs Cron Jobs to be initiated for the following features to operate correctly:

  • Catalog Price rules
  • Sending Newsletters
  • Generating Google Sitemaps
  • Customer Alerts/Notifications (product price change, product back to stock)
  • Automatic updating of currency rates
  • Scheduled DB logs cleanup
  • For our extensions:
    • Fast Asynchronous Re-indexing
    • Asynchronous Cache
    • Advanced Sphinx Search Pro
    • Sphinx Search Ultimate

Setting up the Cron In a UNIX Based Operating System

You can use the crontab service command if you have shell access to the server, or add it through your cPanel or similar admin. You need to make the script run every minute, so in advanced configurations you'd be entering in:

* * * * *

Your crontab should have something like one of these:

* * * * * /bin/sh /[mage_dir]/cron.sh
* * * * * /bin/bash /[mage_dir]/cron.sh
* * * * * /usr/bin/php /[mage_dir]/cron.php
* * * * * /usr/local/bin/php -f /[mage_dir]/cron.php

Run Sphinx Engine on another server

If Sphinx Engine is installed on the other server, you need to manualy setup it's configuration and start sphinx daemon.

Go to System / Configuration / Sphinx Search / Manage Sphinx daemon, select "External Search Engine (another server)", fill "Base Path" (this path should exist on a another server) and press button "Save Config".

After saving you need generate config file, press button "Generate Config file". Then copy configuration files (var/sphinx/sphinx.conf, var/sphinx/synonyms.txt, var/sphinx/stopwords.txt) to the another server with installed sphinx engine, run reindex and then start sphinx daemon.

Managing of Sphinx deamon

Run reindex

indexer --config [path_to_config_file] --rotate [index_name]

* [index_name] may be catalog, cms, awblog etc

Start Sphinx Daemon

searchd --config [path_to_config_file]

Stop Sphinx Daemon

killall -9 searchd

Support

Please, send your questions to support@mirasvit.com. We are always happy to help you.