Try the beta version of the new SilverStripe documentation

For the next 2 weeks you can use the new documentation website and give us your feedback.

close

This document contains information about a future release and not the current stable version (3.1).

Be aware that information on this page may change and API's may not be stable for production use.

Search

Searching for Pages (and Files)

Fulltext search for page content (and other attributes like "Title" or "MetaTags") can be easily added to SilverStripe. See Tutorial: Site Search for details.

Searching for DataObjects

The SearchContext class provides a good base implementation that you can hook into your own controllers. A working implementation of searchable DataObjects can be seen in the [ModelAdmin](framework/en/trunk/reference/modeladmin) class.

SearchContext goes into more detail about setting up a default search form for DataObjects.

Fulltext search on DataObjects

The MySQLDatabase class now defaults to creating tables using the InnoDB storage engine. As Fulltext search in MySQL requires the MyISAM storage engine, any DataObject you wish to use with Fulltext search must be changed to use MyISAM storage engine.

You can do so by adding this static variable to your class definition:

private static $create_table_options = array(
    'MySQLDatabase' => 'ENGINE=MyISAM'
);

Searching for Documents

SilverStripe does not have a built-in method to search through file content (e.g. in PDF or DOC format). You can either extract any textual file content into the File->Content` property, or use a dedicated search service like the sphinx module.

Comments

Comment policy: Please use comments for tips and corrections about the described functionality.
Comments are moderated, we reserve the right to remove comments that are inappropriate or are no longer relevant. Use the Silverstripe Forum to ask questions.

blog comments powered by Disqus