Create custom search index
To perform search by custom entities content, follow these steps:
- Go to
app/code/local/Mirasvit/SearchIndex/Model/Index/
-
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
orapp/codel/local/Mirasvit/SearchIndex/Model/Index/Aw/Kb/Article/Indexer.php
- Copy content from
../Mirasvit/Action/Action/Index.php
to your index file- Rename class
- Change result of method
getBaseGroup
to<Company>
- Change result of method
getBaseTitle
to<Extension>
- Set primary key in method
getPrimaryKey
- Change method
canUse
(it must returnTRUE
) - Set searchable attributes in method
getAvailableAttributes
- Set correct interface to fetch colletion of items in method
getCollection
- Copy content from
../Mirasvit/Action/Action/Indexer.php
to your indexer file- Rename class
- Set correct interface to fetch collection of items in method
_getSearchableEntities
- If all correct, you can add index at Search > Manage Search Indexes
- Add changed to layout file
searchindex.xml
- Create new template at
<package>/<theme>/template/searchindex/index/<company>/<extension>/<entitytype>.phtml
Was this page helpful?
Your feedback about this content is important.
Let us know what you think.