PHPackages                             suilven/freetextsearch - 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. suilven/freetextsearch

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

suilven/freetextsearch
======================

Freetext Search base package for SilverStripe searching

2.0.0(4y ago)01.5k[8 issues](https://github.com/gordonbanderson/freetextsearch/issues)[1 PRs](https://github.com/gordonbanderson/freetextsearch/pulls)1MITPHPPHP ~7.1

Since May 22Pushed 2y ago2 watchersCompare

[ Source](https://github.com/gordonbanderson/freetextsearch)[ Packagist](https://packagist.org/packages/suilven/freetextsearch)[ Docs](https://github.com/suilven/freetextsearch)[ RSS](/packages/suilven-freetextsearch/feed)WikiDiscussions main Synced today

READMEChangelogDependencies (11)Versions (38)Used By (1)

Free Text Search
================

[](#free-text-search)

[![Build](https://github.com/gordonbanderson/freetextsearch/actions/workflows/ci.yml/badge.svg)](https://github.com/gordonbanderson/freetextsearch/actions/workflows/ci.yml)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/02c9020d57c2ca76b67ce540d445c3555523d44f5442f138ea8e6a7186eab544/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f676f72646f6e62616e646572736f6e2f66726565746578747365617263682f6261646765732f7175616c6974792d73636f72652e706e673f623d434f44455f434f564552414745)](https://scrutinizer-ci.com/g/gordonbanderson/freetextsearch/?branch=CODE_COVERAGE)[![codecov.io](https://camo.githubusercontent.com/b851277481bb9f38195d4f6369e6513136df2e5b837985a7ceda4be5aff0d95b/68747470733a2f2f636f6465636f762e696f2f6769746875622f676f72646f6e62616e646572736f6e2f66726565746578747365617263682f636f7665726167652e7376673f6272616e63683d434f44455f434f564552414745)](https://codecov.io/github/gordonbanderson/freetextsearch?branch=CODE_COVERAGE)

[![Latest Stable Version](https://camo.githubusercontent.com/9991d91b0d68657e04c36b196a796fd6fa57d3697346e0978ed44a3d26126294/68747470733a2f2f706f7365722e707567782e6f72672f7375696c76656e2f66726565746578747365617263682f76657273696f6e)](https://packagist.org/packages/suilven/freetextsearch)[![Latest Unstable Version](https://camo.githubusercontent.com/a0d0e195cb846f428c2ca807d92015862f83c00acaebfb4240a6d761465c811a/68747470733a2f2f706f7365722e707567782e6f72672f7375696c76656e2f66726565746578747365617263682f762f756e737461626c65)](//packagist.org/packages/suilven/freetextsearch)[![Total Downloads](https://camo.githubusercontent.com/2b984add4e473e4d616b034838dba5cd192130384d49b414c65d08072a686c2b/68747470733a2f2f706f7365722e707567782e6f72672f7375696c76656e2f66726565746578747365617263682f646f776e6c6f616473)](https://packagist.org/packages/suilven/freetextsearch)[![License](https://camo.githubusercontent.com/a08edf8d1629b7b0e2dd8d0170351e49dfb60e5d915f4ec992660db41df0af35/68747470733a2f2f706f7365722e707567782e6f72672f7375696c76656e2f66726565746578747365617263682f6c6963656e7365)](https://packagist.org/packages/suilven/freetextsearch)[![Monthly Downloads](https://camo.githubusercontent.com/73b5d8e12c0430bdbfe2dbcd35923aeb0b1bcf92ccc0470409cc3e70b7a0409c/68747470733a2f2f706f7365722e707567782e6f72672f7375696c76656e2f66726565746578747365617263682f642f6d6f6e74686c79)](https://packagist.org/packages/suilven/freetextsearch)[![Daily Downloads](https://camo.githubusercontent.com/491cdf917a28486d1e987cb7a637ba776d6585382ceba0f93a3682b66555df52/68747470733a2f2f706f7365722e707567782e6f72672f7375696c76656e2f66726565746578747365617263682f642f6461696c79)](https://packagist.org/packages/suilven/freetextsearch)[![composer.lock](https://camo.githubusercontent.com/a1a91ebb6fc2565c65fc1b5b9d4bf556b94cf0db5fa672c924ed8f02a6c476c0/68747470733a2f2f706f7365722e707567782e6f72672f7375696c76656e2f66726565746578747365617263682f636f6d706f7365726c6f636b)](https://packagist.org/packages/suilven/freetextsearch)

[![GitHub Code Size](https://camo.githubusercontent.com/31e4bc24822b63bfa1af430e31d6da10e4cdd2ca2c770db01eeb6811f4884bc4/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c616e6775616765732f636f64652d73697a652f676f72646f6e62616e646572736f6e2f6672656574657874736561726368)](https://github.com/gordonbanderson/freetextsearch)[![GitHub Repo Size](https://camo.githubusercontent.com/c97d7b943bd9c68dff024e86384e1798fe6956650b2ece260bc1ec1618c04236/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f7265706f2d73697a652f676f72646f6e62616e646572736f6e2f6672656574657874736561726368)](https://github.com/gordonbanderson/freetextsearch)[![GitHub Last Commit](https://camo.githubusercontent.com/fc66371b8080e72db6165340cf2882893dcdd5a420b71d63dca4b6e34931baa5/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6173742d636f6d6d69742f676f72646f6e62616e646572736f6e2f6672656574657874736561726368)](https://github.com/gordonbanderson/freetextsearch)[![GitHub Activity](https://camo.githubusercontent.com/11e384a87030acebd2846ba651bee7c825c5d4fb75eefc65e99602b4c015e118/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f636f6d6d69742d61637469766974792f6d2f676f72646f6e62616e646572736f6e2f6672656574657874736561726368)](https://github.com/gordonbanderson/freetextsearch)[![GitHub Issues](https://camo.githubusercontent.com/2ef21b2471953889c12da1f573bfed40eea87453c05e7beb5b069a2bff3ad22d/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6973737565732f676f72646f6e62616e646572736f6e2f6672656574657874736561726368)](https://github.com/gordonbanderson/freetextsearch/issues)

This module allows configuration of freetext search indexes, and provides tools to create indexes and reindex them. By default only a sitetree index is configured, but one can add indexes for subclasses of SiteTree (e.g. a BlogPost) or a DataObject only index, e.g. flickr photos. The template for rendering the search results can also be overridden.

Note that one also has to install an implementation, currently only one for Manticore Search (formerly Sphinx) exists, package name is `suilven/silverstripe-manticore-search`

Configuration
=============

[](#configuration)

Indexes
-------

[](#indexes)

By default the core fields of SiteTree are indexed. You can override as follows to allow for third party modules or your own. Each index should map to a model class, and the field names match those in the database.

An example follows, code can be found at

```
---
Name: flickrfreetextsearch
After: freetextindexes
---

Suilven\FreeTextSearch\Indexes:
  indexes:
```

The above is compulsory. Additional indexes start here.

```
    - index:
```

The name of the index

```
        name: flickrphotos
```

The class of DataObject being indexed

```
        class: Suilven\Flickr\Model\Flickr\FlickrPhoto
```

These fields are indexed as free text.

```
        fields:
          - Title
          - Description
```

It is not always desirable to show highlights from all of the fields, this is a filter list of fields to render highlights from in search results.

```
        highlighted_fields:
          - Title
          - Description
```

These fields are stored but not searchable. Their function is to provide fields to render in the search results, and avoid hydrating objects from the database. Note that Link is a hybrid field, the existence of a `Link()` method is checked for at indexing time and the field added if the method exists.

```
        stored_fields:
          - ThumbnailURL
          - Link
```

---

The following indexes correctly with Manticoresearch, but note that the ManticoreSearch PHP client does not currently allow for facetted searching. It is in pipeline though. Raw queries show facetted groups returned, but it makes sense to wait for this to be implemented in the PHP client instead.
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

[](#the-following-indexes-correctly-with-manticoresearch-but-note-that-the-manticoresearch-php-client-does-not-currentlyallow-for-facetted-searching--it-is-in-pipeline-though--raw-queries-show-facetted-groups-returned-but-it-makes-senseto-wait-for-this-to-be-implemented-in-the-php-client-instead)

Fields that can be used for facetted searching.

```
        tokens:
          - Aperture
          - ShutterSpeed
          - ISO
          - TakenAt
```

Have one fields are effectively another facet.

```
        has_one:
          - Suilven\Flickr\Model\Flickr\FlickrAuthor
```

This example shows how to index a has many field, tags, for facetting. Each entry has 3 fields:

- `name`: the name of the relationship
- `relationship`: The SilverStripe name of the relationship
- `field`: The `FlickrTags` relationship is a data list of `FlickrTag`, the value stored is that of the `RawValue` field.

```
        has_many:
          -
            name: tags
            relationship: FlickrTags
            field: RawValue
```

Extensions
----------

[](#extensions)

Any class referenced in indexes configuration needs the following extension, `Suilven\FreeTextSearch\Extension\IndexingExtension`, added. This performs one of two jobs:

1. Index a DataObject immediately after it's been saved
2. /or mark a DataObject as dirty and add a job to the queue to process the indexes affected.

```
---
Name: freetextindexes-flickr
After: freetextindexes-extensions
---

Suilven\Flickr\Model\Flickr\FlickrPhoto:
  extensions:
    - Suilven\FreeTextSearch\Extension\IndexingExtension
```

Indexing Mode
-------------

[](#indexing-mode)

In the site configuration there is an additional tab called Free Text Search. It contains two fields:

- `FreeTextSearchIndexingModeInBulk` - tick this to index in bulk via queue, untick to index immediately after writing to the database
- `BulkSize` - the number of DataObjects to index at once

Install
-------

[](#install)

Via Composer

```
$ composer require suilven/freetextsearch
```

Usage
-----

[](#usage)

Indexing
--------

[](#indexing)

Note that these commands require an implementation of freetextsearch.

### Creating an Index

[](#creating-an-index)

Change the name of the index as appropriate. Note that when this command is run, the contents of the index will be dropped, and a reindex will be required.

```
vendor bin/sake dev/tasks/create-index index=sitetree

```

### Reindexing an Index

[](#reindexing-an-index)

Change the name of the index as appropriate. This will reindex in bulk.

```
vendor bin/sake dev/tasks/reindex index=sitetree

```

Adding a Search Page for an Index
---------------------------------

[](#adding-a-search-page-for-an-index)

In the CMS add a page of type `Search Page`. The following fields are editable:

- `IndexToSearch` - the index to search, e.g. `sitetree` or `flickrphotos`
- `PageSize` - the number of search results to return per page

The following are related to facets and not yet implemented:

- `ShowAllIfEmptyQuery` - if this is ticked, search results will be shown for an empty query
- `ShowTagCloudFor` - show tag cloud for a faceted field when there are no search results to be shown

Change log
----------

[](#change-log)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Testing
-------

[](#testing)

```
$ vendor/bin/phpunit tests '' flush=1
```

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) and [CODE\_OF\_CONDUCT](CODE_OF_CONDUCT.md) for details.

Security
--------

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

Credits
-------

[](#credits)

- [Gordon Anderson](https://github.com/gordonbanderson)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity15

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity62

Established project with proven stability

 Bus Factor1

Top contributor holds 100% 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 ~36 days

Recently: every ~96 days

Total

13

Last Release

1640d ago

Major Versions

1.11 → 2.0.02021-11-13

### Community

Maintainers

![](https://www.gravatar.com/avatar/770fae946ca5ca8f0f1f0179462c84d3ca60e9bd32cac3f522fdb64c2e384789?d=identicon)[suilven](/maintainers/suilven)

---

Top Contributors

[![gordonbanderson](https://avatars.githubusercontent.com/u/7060?v=4)](https://github.com/gordonbanderson "gordonbanderson (94 commits)")

---

Tags

suilvenfreetextsearch

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/suilven-freetextsearch/health.svg)

```
[![Health](https://phpackages.com/badges/suilven-freetextsearch/health.svg)](https://phpackages.com/packages/suilven-freetextsearch)
```

###  Alternatives

[silverstripe-terraformers/gridfield-rich-filter-header

Rich filter header component for GridField

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

An all-in-one SEO module for SilverStripe

3328.2k](/packages/quinninteractive-silverstripe-seo)[silverstripe/solr

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

1914.0k](/packages/silverstripe-solr)[heyday/silverstripe-elastica

Provides Elastic Search integration for SilverStripe DataObjects using Elastica

1136.8k2](/packages/heyday-silverstripe-elastica)[wilr/silverstripe-algolia

Algolia Indexer and Search Functionality

1325.5k](/packages/wilr-silverstripe-algolia)

PHPackages © 2026

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