"Long Tail" search (configure a search by SKU, abbreviations etc)

To receive correct search results for words that contain dashes or any other non-alphabetic symbols, we recommend to use long-tail search feature.

Go to System > Configuration > Mirasvit Extensions > Sphinx Search. In the section Merge Settings (Long tail) setup regular expressions to receive required search results.

  • Match Expression - the regular expression(s) that parses words for the further replacing. Parsing goes for search index, during an indexing process, and goes for search phrases during search. E.g. /([a-zA-Z0-9]*[\-\/][a-zA-Z0-9]*[\-\/]*[a-zA-Z0-9]*)/
  • Replace Expression - the regular expression(s) to parse characters to be replaced. Parsing goes in results of "Match Expression". E.g. /[\-\/]/
  • Replace Char - the character to replace values founded by "Replace Expression". E.g. empty value.

How it works?

During reindex extension match search index by Match Expression and then replace chars in matches by Replace Expression to Replace Char.

Same actions extension do for each user search phrase. As result, search index and search query contains same search phrase form.

For example, we have a product "Canon PowerShot SX500 IS".

If customer is searching for the "Canon PowerShot SX-500IS", default search will not find the mentioned product.

Using "long-tail" search, a search function recognizes a characters combination by pattern during reindex and search (by match expression) and replaces special characters (replace expression) to the empty ones or any other characters (replace char).

So, during reindexing the "SX500 IS" will be converted to the "SX500IS" and during the search the "SX-500IS" will be converted to the "SX500IS" aswell. As a result the search will be able to find product by several combinations of product's name spelling.

Example 1

  • Match Expression - /[a-zA-Z0-9]*-[a-zA-Z0-9]*/

    Matched text: SX500-123, GLX-11A, GLZX-VXV, GLZ/123, GLZV 123, CNC-PWR1

  • Replace Expression - /-/
  • Replace Char - empty

Result text: SX500123, GLX11A, GLZXVXV, GLZ/123, GLZV-123-123, CNCPWR1

Example 2

  • Match Expression - /[a-zA-Z0-9]*[ \-\/][a-zA-Z0-9]*/

    Matched text: SX500-123, GLX-11A, GLZX-VXV, GLZ/123, GLZV 123, CNC-PWR1

  • Replace Expression - /[ \-\/]/
  • Replace Char - empty

Result text: SX500123, GLX11A, GLZXVXV, GLZ123, GLZV123, CNCPWR1

Example 3

  • Match Expression - /[a-zA-Z0-9]*[-\/][a-zA-Z0-9]*([-\/][a-zA-Z0-9]*)?/

    Matched text: SX500-123, GLX-11A, GLZX-VXV, GLZ/123, GLZV-123-123, CNC-PWR1

  • Replace Expression - /[-\/]/
  • Replace Char - empty

Result text: SX500123, GLX11A, GLZXVXV, GLZ123, GLZV123123, CNCPWR1

Advanced Sphinx Search Pro