PHPackages                             distantnative/search-for-kirby - 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. distantnative/search-for-kirby

AbandonedArchivedKirby-plugin[Search &amp; Filtering](/categories/search)

distantnative/search-for-kirby
==============================

Really find what you are looking for.

1.1.1(5y ago)42797↓100%3[6 issues](https://github.com/distantnative/search-for-kirby/issues)MITPHP

Since Aug 9Pushed 4y ago1 watchersCompare

[ Source](https://github.com/distantnative/search-for-kirby)[ Packagist](https://packagist.org/packages/distantnative/search-for-kirby)[ Fund](https://paypal.me/distantnative)[ RSS](/packages/distantnative-search-for-kirby/feed)WikiDiscussions main Synced today

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

> **⏸ Development ended - open to handover project**
> Unfortunately, I am lacking time and energy to actively uphold development of this plugin. I will archive the plugin as-is for the time being. Be aware that it doesn't support Kirby 3.6+. If anyone would like to take over and continue the development of this plugin, I'd be very happy - please get in touch.

Search for Kirby
================

[](#search-for-kirby)

[![Version](https://camo.githubusercontent.com/eb991f08500b0483551bc9c06bcd9ffac8c0e225133246b1a59c7461059f9f3b/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f72656c656173652d312e312e312d3432373161652e7376673f7374796c653d666f722d7468652d6261646765)](https://github.com/distantnative/search-for-kirby/releases)[![Dependency](https://camo.githubusercontent.com/71fdc5690b806a6a58d65688813fcf7c03125686dc8d8351994bc9e5384be5ff/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6b697262792d332e352e302d6363613030302e7376673f7374796c653d666f722d7468652d6261646765)](https://getkirby.com/)[![License](https://camo.githubusercontent.com/7b781045e8188412226c61ea42ed54b9cafff70a0d393f20f89f2c2e80691632/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d3765613332382e7376673f7374796c653d666f722d7468652d6261646765)](https://opensource.org/licenses/MIT)[![Donate](https://camo.githubusercontent.com/f4cb6f8a622a656bcb9ba3d821cfed32c504968b26b8386113c612498f88853a/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f737570706f72742d646f6e6174652d6338323832392e7376673f7374796c653d666f722d7468652d6261646765)](https://paypal.me/distantnative)

[![Screenshot](screenshot.jpg)](https://distantnative.com/search)

Gettting started
----------------

[](#gettting-started)

### Installation

[](#installation)

[Download](https://github.com/distantnative/search-for-kirby/archive/main.zip), unzip and copy this repository to `/site/plugins/search`.

Alternatively, you can install it with composer:

```
composer require distantnative/search-for-kirby

```

Decide which provider you want to use (see below for the available providers). And don't forget to create the index (also below) before the first run, if using the Sqlite or Algolia provider.

### Updates

[](#updates)

Replace the `/site/plugins/search` folder with the new version. Make sure to read the release notes for breaking changes.

Or if you installed the plugin via composer, run:

```
composer update distantnative/search-for-kirby

```

Entries
-------

[](#entries)

The plugin offers a global search across different entries combined: `pages`, `files` and `users`.

You can define what should be included as entries in the index (using the Kirby [query language](https://getkirby.com/docs/guide/blueprints/query-language)) or even disable a type completely in your `site/config/config.php`:

```
'search' => [
    'entries' => [
        'pages' => 'site.find("projects").index',
        'files' => false,
        // users will remain the default
    ]
]
```

By default the following collections are included in the index:

#### `pages`

[](#pages)

```
site.index

```

#### `files`

[](#files)

```
site.index.files

```

#### `users`

[](#users)

```
kirby.users

```

Fields
------

[](#fields)

You can define in your `config.php` file which content fields of your pages, files and users to include in the search:

```
'search' => [
    'fields' => [
        'pages' => [
            'title'
        ],
        'files' => [
            'filename'
        ],
        'users' => [
            'email',
            'name'
        ]
    ]
]
```

There are several options how to define fields in these arrays:

```
// Simply add the field
'title',

// Add the field, but run it through a field method first
'text' => 'kirbytext',

// Pass parameters to the field method
'text' => ['short', 50],

// Use a callback function
'text' => function ($model) {
    return strip_tags($model->text()->kt());
}

// Turn string field value into number (e.g. for Algolia filters)
'myNumberField' => function ($model) {
    return $model->myNumberField()->toFloat();
}

'myVirtualNumberField' => function ($model) {
    return $model->myNumberField()->toInt() + 5;
}

'myDate' => function ($model) {
    return $model->anyDateField()->toTimestamp();
}
```

Templates
---------

[](#templates)

You can also define in your `config.php` file which templates (or roles in the case of users) to include in the search:

```
'search' => [
    'templates' => [
        'pages' => function ($model) {
             return $model->id() !== 'home' && $model->id() !== 'error';
         },
        'files' => null,
        'users' => null
    ]
]
``

If the value is null or an empty array, all templates are allowed. If it is false, all templates are excluded. There are several other options:

```php
// simple whitelist array
['project', 'note', 'album']

// associative array
[
    'project' => true,
    'note'    => false
]

// callback function
function ($model) {
    return $model->intendedTemplate() !== 'secret';
}
```

Usage
-----

[](#usage)

### In the Panel

[](#in-the-panel)

The plugin replaces the default Panel search (access at the top right via the magnifying glass icon) with its global search modal:

    screencast.mp4    ### On the frontend

[](#on-the-frontend)

The plugin also replaces the PHP API methods. Since the plugin provides global search, it is best to be used with the $site object as a start:

```
$site->search('query', $options = []);
```

Nevertheless, search can also be limited to more specific collections (with some performance loss):

```
$page->children()->listed()->filterBy('template', 'project')->search('query', $options = []);
```

The plugin also adds a global `search()` helper function:

```
search(string $query, $options = [], $collection = null)
```

For the options array you can pass a limit option to sepcify the number of results to be returned. Moreover you can specify an operator option (`AND` or `OR`) to specify the rule multiple search terms get combined:

```
collection('notes')->search($query, [
    'operator' => 'AND',
    'limit' => 100
]);
```

The result you receive is a [`Kirby\Cms\Collection` object](https://getkirby.com/docs/reference/objects/cms/collection).

Providers
---------

[](#providers)

The plugin bundles three different search providers. Depending on your site, needs and setup, one of these might be more suitable than others.

### `sqlite` (default)

[](#sqlite-default)

Creates an index SQLite database using the SQLite FTS5 extension (must be available).

In the config, you can redefine the location for the database file, providing an absolute path. By default the database file will be created as `site/logs/search/index.sqlite`.

```
// site/config/config.php

'search' => [
    'provider' => 'sqlite',
    'sqlite' => [
        'file'  => dirname(__DIR__, 2) . '/storage/search/index.sqlite'

    ]
]
```

The fuzzy option allows a search to match content not only from the beginning of words but also inside them. Depending on the content, it can drastically increase the size of the index database (think exponentially), especially when including long text fields. You can also define lists of fields to make fuzzy.

```
// site/config/config.php

'search' => [
    'provider' => 'sqlite',
    'sqlite' => [
        // Enabled for all fields
        'fuzzy' => true,

        // Disabled completely
        'fuzzy' => false,

        // Only for selected fields
        'fuzzy' => [
            'pages' => ['title'],
            'files' => ['caption', 'credits']
        ],
    ]
]
```

You can also define some custom weights to rank specific fields higher than others:

```
// site/config/config.php

'search' => [
    'provider' => 'sqlite',
    'sqlite' => [
        'weights' => [
            'title'   => 10,
            'caption' => 5
        ],
    ]
]
```

### `algolia`

[](#algolia)

Add Algolia search seamlessly to Kirby with this provider:

```
// site/config/config.php

'search' => [
    'provider' => 'algolia',
    'algolia' => [
        'app'     => ...,     // Algolia App ID
        'key'     => ...,     // Algolia private admin key (not just read-only!)
        'index'   => 'kirby'  // name of the index to use/create
        'options' => []       // options to pass to Algolia at search
    ]
]
```

### Generating the index

[](#generating-the-index)

#### Panel section

[](#panel-section)

To create an initial index, the plugin bundles a small Panel section from which you can trigger building the index. Add the following section to e.g. your `site.yml` blueprint:

```
sections:
  search:
    type: search
```

#### Hooks

[](#hooks)

By default, the plugin makes sure to update the search index at each event (creating a page, uploading a file, updating content etc.) via hooks. So you do not need to worry to creating a new index each time content gets edited.

To deactivate automatic index updates via hooks, add the following to your `site/config/config.php`:

```
'search' => [
  'hooks' => false
]
```

#### Shell script

[](#shell-script)

You can also build the index from the command line with the `./index` shell script included in the plugin. This can be an alternative to the Panel section (especially for a very big index file) or replace hooks in setups that do not use the Panel – then triggered e.g. when deploying a new commit or via a cronjob.

```
./site/plugins/search/bin/index
```

If you are using a custom folder setup, you will have to create a modified version of that script. Get in touch, if you need help.

Troubleshooting
---------------

[](#troubleshooting)

This plugin is provided "as is" with no guarantees. Use it at your own risk and always test it yourself before using it in a production environment. If you encounter any problem, please [create an issue](https://github.com/distantnative/search-for-kirby/issues).

### Missing Sqlite extension

[](#missing-sqlite-extension)

When generating the index, you might encounter the error could not find driver. This most likely means that your server setup is missing the Sqlite extensions. It has worked out for other users to activate the following extensions:

```
extension=sqlite3.so
extension=pdo_sqlite.so

```

Pay it forward 💛
----------------

[](#pay-it-forward-)

This plugin is completely free and published under the MIT license. However, development needs time and effort. If you are using it in a commercial project or just want to support me to keep this plugin alive, please [make a donation of your choice](https://paypal.me/distantnative).

###  Health Score

31

—

LowBetter than 71% of packages

Maintenance17

Infrequent updates — may be unmaintained

Popularity27

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity56

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 66.7% 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 ~93 days

Total

3

Last Release

1863d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/38dee61adefb0d9fae59254a74cdaf33d8b4fcac96b451b9f9c46e0ab3ec1279?d=identicon)[distantnative](/maintainers/distantnative)

---

Top Contributors

[![caplod](https://avatars.githubusercontent.com/u/435070?v=4)](https://github.com/caplod "caplod (4 commits)")[![afbora](https://avatars.githubusercontent.com/u/3393422?v=4)](https://github.com/afbora "afbora (1 commits)")[![distantnative](https://avatars.githubusercontent.com/u/3788865?v=4)](https://github.com/distantnative "distantnative (1 commits)")

---

Tags

algoliafts5full-text-searchkirbykirby-cmskirby-pluginsearchsearchkirby3kirby3-pluginkirby3-cms

### Embed Badge

![Health badge](/badges/distantnative-search-for-kirby/health.svg)

```
[![Health](https://phpackages.com/badges/distantnative-search-for-kirby/health.svg)](https://phpackages.com/packages/distantnative-search-for-kirby)
```

###  Alternatives

[bvdputte/kirby-bettersearch

A search plugin for Kirby (v3+ that searches for full word combinations rather than just individual words.

233.5k](/packages/bvdputte-kirby-bettersearch)[fabianmichael/kirby-meta

Your all-in-one powerhouse for any SEO and metadata needs imaginable.

6810.4k1](/packages/fabianmichael-kirby-meta)[johannschopplich/kirby-algolia-docsearch

Algolia DocSearch plugin for Kirby CMS

261.7k](/packages/johannschopplich-kirby-algolia-docsearch)[schnti/cachebuster

A plugin for Kirby 3 CMS to add modification timestamps to css and js files

118.2k1](/packages/schnti-cachebuster)[bnomei/kirby3-php-cachedriver

PHP based Cache-Driver

112.6k](/packages/bnomei-kirby3-php-cachedriver)

PHPackages © 2026

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