I18N Search - Custom Indexing

Custom Field Indexing

See the I18N Custom Fields plugin as example.

Here is an example of a plugin on how to tag all pages with the virtual keyword _page and all pages in the menu with the virtual keyword _menu and to add the contents of a field 'myfield' to the indexer:

...
add_filter('search-index-page', 'myplugin_search_index');

function myplugin_search_index($item) {
  # all pages get the _page tag:
  $tags = array('_page');
  # only pages in the menu get the _menu tag:
  if ($item->menuStatus == 'Y') $tags[] = '_menu';
  $item->addTags('page_tags', $tags); 
  # assuming we have a (custom) field myfield, we can add its content:
  $item->addContent('myfield', 
    html_entity_decode(strip_tags($item->myfield), ENT_QUOTES, 'UTF-8')); 
}
...

(You can also put this code in the top of your template file and it should work)

You can then display the 10 last modified pages in the menu e.g. with:

(% searchresults tags=_menu order=date max=10 %)

Using the parameter component you can render them in a custom way (see here)

Custom Item Indexing

Plugin developers, see the example plugin i18n_search_dummy.zip.