Create custom search index

To perform search by custom entities content, follow these steps:

  1. Go to app/code/local/Mirasvit/SearchIndex/Model/Index/
  2. Create folder/file structure

    • <Company>/<Extension>/<EntityType>/Index.php
    • <Company>/<Extension>/<EntityType>/Indexer.php

    i.e. app/codel/local/Mirasvit/SearchIndex/Model/Index/Mirasvit/News/News/Index.php or app/codel/local/Mirasvit/SearchIndex/Model/Index/Aw/Kb/Article/Indexer.php

  3. Copy content from ../Mirasvit/Action/Action/Index.php to your index file
    1. Rename class
    2. Change result of method getBaseGroup to <Company>
    3. Change result of method getBaseTitle to <Extension>
    4. Set primary key in method getPrimaryKey
    5. Change method canUse (it must return TRUE)
    6. Set searchable attributes in method getAvailableAttributes
    7. Set correct interface to fetch colletion of items in method getCollection
  4. Copy content from ../Mirasvit/Action/Action/Indexer.php to your indexer file
    1. Rename class
    2. Set correct interface to fetch collection of items in method _getSearchableEntities
  5. If all correct, you can add index at Search > Manage Search Indexes
  6. Add changed to layout file searchindex.xml
  7. Create new template at <package>/<theme>/template/searchindex/index/<company>/<extension>/<entitytype>.phtml
Advanced Sphinx Search Pro