PHPackages                             firebrandhq/searchable-dataobjects - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Search &amp; Filtering](/categories/search)
4. /
5. firebrandhq/searchable-dataobjects

ActiveSilverstripe-module[Search &amp; Filtering](/categories/search)

firebrandhq/searchable-dataobjects
==================================

Fork of zirak/searchable-dataobjects to include dataobjects' parent pages in search results.

v1.2.3(8y ago)83.0k3[3 issues](https://github.com/firebrandhq/silverstripe-searchable-dataobjects/issues)[2 PRs](https://github.com/firebrandhq/silverstripe-searchable-dataobjects/pulls)GPL-2.0-or-laterPHP

Since May 14Pushed 8y ago1 watchersCompare

[ Source](https://github.com/firebrandhq/silverstripe-searchable-dataobjects)[ Packagist](https://packagist.org/packages/firebrandhq/searchable-dataobjects)[ RSS](/packages/firebrandhq-searchable-dataobjects/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (2)Dependencies (3)Versions (12)Used By (0)

Firebrand Searchable DataObjects
================================

[](#firebrand-searchable-dataobjects)

Firebrand Searchable DataObjects is a fork of [Zirak's Searchable DataObjects](https://github.com/g4b0/silverstripe-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
------------

[](#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
------------

[](#requirements)

- SilverStripe 3.1
- zirak/htmlpurifier

### Installation

[](#installation)

Install the module through [composer](http://getcomposer.org):

```
composer require firebrandhq/searchable-dataobjects
```

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`.

```
class DoNews extends DataObject implements SearchableLinkable {

	private static $db = array(
		'Title' => 'Varchar',
		'Subtitle' => 'Varchar',
		'News' => 'HTMLText',
		'Date' => 'Date',
	);
	private static $has_one = array(
		'Page' => 'PghNews'
	);

	private static $has_many = array(
		'Asides' => 'Aside'
	);

	/**
	 * Filter array
	 * eg. array('Disabled' => 0);
	 * @return array
	 */
	public static function getSearchFilter() {
		return array();
	}

	/**
	 * Fields that compose the Title
	 * eg. array('Title', 'Subtitle');
	 * @return array
	 */
	public function getTitleFields() {
		return array('Title');
	}

	/**
	 * Fields that compose the Content
	 * eg. array('Teaser', 'Content');
	 * @return array
	 */
	public function getContentFields() {
		return array('Subtitle', 'Content');
	}

	/**
	 * Parent objects that should be displayed in search results.
	 * @return SiteTree or SearchableLinkable
	 */
	public function getOwner() {
		return $this;
	}

	/**
	 * Whatever this specific Searchable should be included in search results.
	 * This allows you to exclude some DataObjects from search results.
	 * It plays more or less the same role that ShowInSearch plays for SiteTree.
	 * @return boolean
	 */
	public function IncludeInSearch() {
		return true;
	}

	/**
	 * Link to access this DO
	 * @return string
	 */
	public function Link() {
		$this->Page->Link('news/' . $this->ID);
	}
}
```

```
class Aside extends DataObject implements Searchable {

	private static $db = array(
		'Header' => 'Varchar',
		'Content' => 'HTMLText',
	);
	private static $has_one = array(
		'DoNews' => 'DoNews'
	);

	/**
	 * Filter array
	 * eg. array('Disabled' => 0);
	 * @return array
	 */
	public static function getSearchFilter() {
		return array();
	}

	/**
	 * Fields that compose the Title
	 * eg. array('Title', 'Subtitle');
	 * @return array
	 */
	public function getTitleFields() {
		return array('Header');
	}

	/**
	 * Fields that compose the Content
	 * eg. array('Teaser', 'Content');
	 * @return array
	 */
	public function getContentFields() {
		return array('Content');
	}

	/**
	 * Parent objects that should be displayed in search results.
	 * @return SiteTree or SearchableLinkable
	 */
	public function getOwner() {
		return $this->DoNews;
	}

	/**
	 * Whatever this specific Searchable should be included in search results.
	 * This allows you to exclude some DataObjects from search results.
	 * It plays more or less the same role that ShowInSearch plays for SiteTree.
	 * @return boolean
	 */
	public function IncludeInSearch() {
		return true;
	}
}
```

Extend Page and the desired DataObjects through the following yaml:

```
Page:
	extensions:
		- SearchableDataObject
DoNews:
	extensions:
		- SearchableDataObject
```

Run a `dev/build` and then populate the search table running PopulateSearch task:

```
sake dev/build "flush=all"
sake dev/tasks/PopulateSearch
```

When you save your pages or you DataObject, they will automatically update their entry in the search table.

### Note

[](#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 \[\]:

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.

###  Health Score

34

—

LowBetter than 77% of packages

Maintenance13

Infrequent updates — may be unmaintained

Popularity24

Limited adoption so far

Community16

Small or concentrated contributor base

Maturity70

Established project with proven stability

 Bus Factor1

Top contributor holds 65.4% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~157 days

Recently: every ~258 days

Total

10

Last Release

2967d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/eb656fdb4734a2490b0b88295b5d35f59e0ee709611ed7b7b0fdbc33eaad2c82?d=identicon)[firebrandhq](/maintainers/firebrandhq)

---

Top Contributors

[![g4b0](https://avatars.githubusercontent.com/u/2427390?v=4)](https://github.com/g4b0 "g4b0 (17 commits)")[![ntsim](https://avatars.githubusercontent.com/u/9917868?v=4)](https://github.com/ntsim "ntsim (3 commits)")[![marc-firebrand](https://avatars.githubusercontent.com/u/33405402?v=4)](https://github.com/marc-firebrand "marc-firebrand (2 commits)")[![maxime-rainville](https://avatars.githubusercontent.com/u/1168676?v=4)](https://github.com/maxime-rainville "maxime-rainville (1 commits)")[![OliverJonesFB](https://avatars.githubusercontent.com/u/13229084?v=4)](https://github.com/OliverJonesFB "OliverJonesFB (1 commits)")[![wernerkrauss](https://avatars.githubusercontent.com/u/1043925?v=4)](https://github.com/wernerkrauss "wernerkrauss (1 commits)")[![yusuf](https://avatars.githubusercontent.com/u/90121?v=4)](https://github.com/yusuf "yusuf (1 commits)")

---

Tags

searchsilverstripedataobject

### Embed Badge

![Health badge](/badges/firebrandhq-searchable-dataobjects/health.svg)

```
[![Health](https://phpackages.com/badges/firebrandhq-searchable-dataobjects/health.svg)](https://phpackages.com/packages/firebrandhq-searchable-dataobjects)
```

###  Alternatives

[g4b0/searchable-dataobjects

This module adds DataObjects to frontend search

254.9k](/packages/g4b0-searchable-dataobjects)[silverstripe/solr

Solr integration for SilverStripe. Note that this is NOT related to the silverstripe/fulltext package.

1914.0k](/packages/silverstripe-solr)[silverstripe-terraformers/gridfield-rich-filter-header

Rich filter header component for GridField

1325.7k1](/packages/silverstripe-terraformers-gridfield-rich-filter-header)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
