Download the PHP package firebrandhq/searchable-dataobjects without Composer
On this page you can find all versions of the php package firebrandhq/searchable-dataobjects. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download firebrandhq/searchable-dataobjects
More information about firebrandhq/searchable-dataobjects
Files in firebrandhq/searchable-dataobjects
Package searchable-dataobjects
Short Description Fork of zirak/searchable-dataobjects to include dataobjects' parent pages in search results.
License GPL-2.0-or-later
Informations about the package searchable-dataobjects
Firebrand Searchable DataObjects
Firebrand Searchable DataObjects is a fork of Zirak's Searchable DataObjects.
Firebrand's version will return Pages matching a search criteria or having related Data Objects matching the search criteria. Zirak's version returns the DataObjects individual data objects.
Introduction
Complexe SilverStripe pages will sometimes need to be divided up in various parts using DataObjects. Out of the box SilverStripe will only index the content in the main WYSIWYG area of a page. This means that related DataObjects will not be indexed and that their parent pages will not be returned in search results.
Requirements
- SilverStripe 3.1
- zirak/htmlpurifier
Installation
Install the module through composer:
Make the DataObject (or Pages) implement Searchable
or SearchableLinkable
interface. You need to define getSearchFilter()
, getTitleFields()
, getContentFields()
, getOwner()
, IncludeInSearch()
). Classes that implement the SearchableLinkable
interface, must additionnaly define a Link()
function.
DataObjects that are accessible via a URL should implement SearchableLinkable
while DataObjects that belong to a parent object without being reable directly URL accessible should implement Searchable
.
Extend Page and the desired DataObjects through the following yaml:
Run a dev/build
and then populate the search table running PopulateSearch task:
When you save your pages or you DataObject, they will automatically update their entry in the search table.
Note
Searchable DataObjects module use Mysql NATURAL LANGUAGE MODE search method, so during your tests be sure not to have all DataObjetcs with the same content, since words that are present in 50% or more of the rows are considered common and do not match.
From MySQL manual entry [http://dev.mysql.com/doc/refman/5.1/en/fulltext-search.html]:
A natural language search interprets the search string as a phrase in natural human language (a phrase in free text). There are no special operators. The stopword list applies. In addition, words that are present in 50% or more of the rows are considered common and do not match. Full-text searches are natural language searches if the IN NATURAL LANGUAGE MODE modifier is given or if no modifier is given.
All versions of searchable-dataobjects with dependencies
silverstripe/cms Version 3.*
zirak/htmlpurifier Version 1.0.*