PHPackages                             toastnz/fulltextsearch - 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. toastnz/fulltextsearch

ActiveSilverstripe-vendormodule

toastnz/fulltextsearch
======================

Adds support for Fulltext Search engines like Sphinx and Solr to SilverStripe CMS

4.0.0(3y ago)07011BSD-3-ClausePHPPHP &gt;=8.0

Since Oct 8Pushed 3y agoCompare

[ Source](https://github.com/leandro-toastnz/silverstripe-fulltextsearch)[ Packagist](https://packagist.org/packages/toastnz/fulltextsearch)[ RSS](/packages/toastnz-fulltextsearch/feed)WikiDiscussions 3 Synced today

READMEChangelog (1)Dependencies (8)Versions (66)Used By (0)

FullTextSearch module
=====================

[](#fulltextsearch-module)

[![Build Status](https://camo.githubusercontent.com/70aada6afd516f5cebc464c0a7ad08a62168feb62b72dacf85dfcf562de67cf4/687474703a2f2f696d672e736869656c64732e696f2f7472617669732f73696c7665727374726970652f73696c7665727374726970652d66756c6c746578747365617263682e7376673f7374796c653d666c6174)](https://travis-ci.org/silverstripe/silverstripe-fulltextsearch)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/fc751ed99f9ddfe3ae07063bb0aa301cb7bf36ce63538de26ff72e97aa4be422/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f73696c7665727374726970652f73696c7665727374726970652d66756c6c746578747365617263682f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/silverstripe/silverstripe-fulltextsearch/?branch=master)[![codecov](https://camo.githubusercontent.com/f96120627a5be743cf7744c0d9c4afc1f4f41009ae69acec813a06724e8e49f9/68747470733a2f2f636f6465636f762e696f2f67682f73696c7665727374726970652f73696c7665727374726970652d66756c6c746578747365617263682f6272616e63682f6d61737465722f67726170682f62616467652e737667)](https://codecov.io/gh/silverstripe/silverstripe-fulltextsearch)[![SilverStripe supported module](https://camo.githubusercontent.com/9b7e93d393a01f6d3091fb30983b870aa863ef076858115faaa1c74b995854ec/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f73696c7665727374726970652d737570706f727465642d3030373143342e737667)](https://www.silverstripe.org/software/addons/silverstripe-commercially-supported-module-list/)

Adds support for fulltext search engines like Sphinx and Solr to SilverStripe CMS. Compatible with PHP 7.2

Important notes when upgrading to fulltextsearch 3.7.0+
-------------------------------------------------------

[](#important-notes-when-upgrading-to-fulltextsearch-370)

There are some significant changes from previous versions:

Draft content will no longer be automatically added to the search index. This new behaviour was previously an opt-in behaviour that was enabled by adding the following line to a search index:

```
$this->excludeVariantState([SearchVariantVersioned::class => Versioned::DRAFT]);

```

A new `canView()` check against an anonymous user (i.e. someone not logged in) and a `ShowInSearch` check is now performed by default against all records (DataObjects) before being added to the search index, and also before being shown in search results. This may mean that some records that were previously being indexed and shown in search results will no longer appear due to these additional checks.

These additional checks have been added with data security in mind, and it's assumed that records failing these checks probably should not be indexed in the first place.

Enable indexing of draft content:
=================================

[](#enable-indexing-of-draft-content)

You can index draft content with the following yml configuration:

```
SilverStripe\FullTextSearch\Search\Services\SearchableService:
  variant_state_draft_excluded: false

```

However, when set to false, it will still only index draft content when a DataObject is in a published state, not a draft-only or modified state. This is because it will still fail the new anonymous user `canView()` check in `SearchableService::isSearchable()` and be automatically deleted from the index.

If you wish to also index draft content when a DataObject is in a draft-only or a modified state, then you'll need to also configure `SearchableService::indexing_canview_exclude_classes`. See below for instructions on how to do this.

Disabling the anonymous user canView() pre-index check
======================================================

[](#disabling-the-anonymous-user-canview-pre-index-check)

You can apply configuration to remove the new pre-index `canView()` check from your DataObjects if it is not necessary, or if it impedes expected functionality (e.g. for sites where users must authenticate to view any content). This will also disable the check for descendants of the specified DataObjects. Ensure that your implementation of fulltextsearch is correctly performing a `canView()` check at query time before disabling the pre-index check, as this may result in leakage of private data.

```
SilverStripe\FullTextSearch\Search\Services\SearchableService:
  indexing_canview_exclude_classes:
    - Some\Org\MyDataObject
    # This will disable the check for all pagetypes:
    - SilverStripe\CMS\Model\SiteTree

```

You can also use the `updateIsSearchable` extension point on `SearchableService` to modify the result of the method after the `ShowInSearch` and `canView()` checks have run.

It is highly recommend you run a [solr\_reindex](https://github.com/silverstripe/silverstripe-fulltextsearch/blob/3/docs/en/03_configuration.md#solr-reindex)on your production site after upgrading from 3.6 or earlier to purge any old data that should no longer be in the search index.

These additional check can have an impact on the reindex performance due to additional queries for permission checks. If your site also indexes content in files, such as pdf's or docx's, using the [text-extraction](https://github.com/silverstripe/silverstripe-textextraction)module which is fairly time-intensive, then the relative performance impact of the `canView()` checks won't be as noticeable.

Details on filtering before adding content to the solr index
------------------------------------------------------------

[](#details-on-filtering-before-adding-content-to-the-solr-index)

- `SearchableService::isIndexable()` check in `SolrReindexBase`. Used when indexing all records during Solr reindex.
- `SearchableService::isIndexable()` check in `SearchUpdateProcessor`. Used when indexing single records during `DataObject->write()`.

Details on filtering when extracting results from the solr index
----------------------------------------------------------------

[](#details-on-filtering-when-extracting-results-from-the-solr-index)

- `SearchableService::isViewable()` check in `SolrIndex`. This will often be used in CWP implementations that use the `CwpSearchEngine` class, as well as most custom implementations that call `MySearchIndex->search()`
- `SearchableService::isViewable()` check in `SearchForm`. This will be used in solr implementations where a `/SearchForm` url is used to display search results.
- Some implementations will call `SearchableService::isViewable()` twice. If this happens then the first call will be cached in memory so there is virtually no performance penalty calling it a second time.
- If your implementation is very custom and does not subclass nor make use of either `SolrIndex` or `SearchForm`, then it's recommended you update your implementation to call `SearchableService::isViewable()`.

Requirements
------------

[](#requirements)

- SilverStripe 4.0+

**Note:** For SilverStripe 3.x, please use the [2.x release line](https://github.com/silverstripe/silverstripe-fulltextsearch/tree/2).

Documentation
-------------

[](#documentation)

For pure Solr docs, check out [the Solr 4.10.4 guide](https://archive.apache.org/dist/lucene/solr/ref-guide/apache-solr-ref-guide-4.10.pdf).

See [the docs](/docs/en/00_index.md) for configuration and setup, or for the quick version see [the quick start guide](/docs/en/01_getting_started.md#quick-start).

For details of updates, bugfixes, and features, please see the [changelog](CHANGELOG.md).

TODO
----

[](#todo)

- Get rid of includeSubclasses - isn't actually used in practice, makes the codebase uglier, and ClassHierarchy can be used at query time for most of the same use cases
- Fix field referencing in queries. Should be able to do `$query->search('Text', 'Content')`, not `$query->search('Text', SiteTree::class . '_Content')` like you have to do now

    - Make sure that when field exists in multiple classes, searching against bare fields searches all of them
    - Allow searching against specific instances too
- Make fields restrictable by class in an index - 'SiteTree#Content' to limit fields to a particular class, maybe 'Content-&gt;Summary' to allow calling a specific method on the field object to get the text
- Allow following user relationships (Children.Foo for example)
- Be clearer about what happens with relationships to stateful objects (e.g. Parent.Foo where Parent is versioned)
- Improvements to SearchUpdater

    - Make it work properly when in-between objects (the A in A.B.Foo) update
    - Allow user logic to cause triggering reindex of documents when field is user generated
- Add generic APIs for spell correction, file text extraction and snippet generation

###  Health Score

37

—

LowBetter than 83% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community20

Small or concentrated contributor base

Maturity82

Battle-tested with a long release history

 Bus Factor3

3 contributors hold 50%+ of commits

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 ~53 days

Recently: every ~166 days

Total

62

Last Release

1363d ago

Major Versions

2.4.0 → 3.0.0-beta12017-12-10

2.4.x-dev → 3.4.x-dev2019-04-17

2.5.x-dev → 3.6.12020-01-08

2.x-dev → 3.7.0-rc12020-06-15

3.x-dev → 4.0.02022-08-16

PHP version history (2 changes)3.7.0PHP &gt;=7.1

4.0.0PHP &gt;=8.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/49888163?v=4)[Leandro Palmieri](/maintainers/leandro-toastnz)[@leandro-toastnz](https://github.com/leandro-toastnz)

---

Top Contributors

[![robbieaverill](https://avatars.githubusercontent.com/u/5170590?v=4)](https://github.com/robbieaverill "robbieaverill (120 commits)")[![chillu](https://avatars.githubusercontent.com/u/111025?v=4)](https://github.com/chillu "chillu (50 commits)")[![dhensby](https://avatars.githubusercontent.com/u/563596?v=4)](https://github.com/dhensby "dhensby (45 commits)")[![brettt89](https://avatars.githubusercontent.com/u/4122344?v=4)](https://github.com/brettt89 "brettt89 (37 commits)")[![NightJar](https://avatars.githubusercontent.com/u/778003?v=4)](https://github.com/NightJar "NightJar (20 commits)")[![andrewandante](https://avatars.githubusercontent.com/u/9702648?v=4)](https://github.com/andrewandante "andrewandante (12 commits)")[![ScopeyNZ](https://avatars.githubusercontent.com/u/3260989?v=4)](https://github.com/ScopeyNZ "ScopeyNZ (10 commits)")[![raissanorth](https://avatars.githubusercontent.com/u/14869519?v=4)](https://github.com/raissanorth "raissanorth (10 commits)")[![silverstripe-elliot](https://avatars.githubusercontent.com/u/5863816?v=4)](https://github.com/silverstripe-elliot "silverstripe-elliot (8 commits)")[![wilr](https://avatars.githubusercontent.com/u/101629?v=4)](https://github.com/wilr "wilr (8 commits)")[![mateusz](https://avatars.githubusercontent.com/u/118653?v=4)](https://github.com/mateusz "mateusz (7 commits)")[![Leapfrognz](https://avatars.githubusercontent.com/u/1740262?v=4)](https://github.com/Leapfrognz "Leapfrognz (6 commits)")[![halkyon](https://avatars.githubusercontent.com/u/138450?v=4)](https://github.com/halkyon "halkyon (5 commits)")[![ShrikeFIN](https://avatars.githubusercontent.com/u/1734521?v=4)](https://github.com/ShrikeFIN "ShrikeFIN (5 commits)")[![emteknetnz](https://avatars.githubusercontent.com/u/4809037?v=4)](https://github.com/emteknetnz "emteknetnz (4 commits)")[![michalkleiner](https://avatars.githubusercontent.com/u/233342?v=4)](https://github.com/michalkleiner "michalkleiner (4 commits)")[![adrexia](https://avatars.githubusercontent.com/u/984753?v=4)](https://github.com/adrexia "adrexia (3 commits)")[![leandro-toastnz](https://avatars.githubusercontent.com/u/49888163?v=4)](https://github.com/leandro-toastnz "leandro-toastnz (3 commits)")[![UndefinedOffset](https://avatars.githubusercontent.com/u/1391558?v=4)](https://github.com/UndefinedOffset "UndefinedOffset (3 commits)")[![magnusbengtsson](https://avatars.githubusercontent.com/u/1381028?v=4)](https://github.com/magnusbengtsson "magnusbengtsson (2 commits)")

---

Tags

silverstripesolrfulltextsphinx

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/toastnz-fulltextsearch/health.svg)

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

###  Alternatives

[silverstripe/fulltextsearch

Adds support for Fulltext Search engines like Sphinx and Solr to SilverStripe CMS

44298.1k12](/packages/silverstripe-fulltextsearch)[silverstripe/framework

The SilverStripe framework

7213.5M2.5k](/packages/silverstripe-framework)[silverstripe/cms

The SilverStripe Content Management System

5163.4M1.3k](/packages/silverstripe-cms)[yiisoft/yii2-sphinx

Sphinx full text search engine extension for the Yii framework

180997.7k5](/packages/yiisoft-yii2-sphinx)[silverstripe/admin

SilverStripe admin interface

262.6M325](/packages/silverstripe-admin)[lekoala/silverstripe-debugbar

DebugBar for SilverStripe CMS

55243.0k1](/packages/lekoala-silverstripe-debugbar)

PHPackages © 2026

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