PHPackages                             silverstripe/silverstripe-discoverer-search-ui - 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. silverstripe/silverstripe-discoverer-search-ui

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

silverstripe/silverstripe-discoverer-search-ui
==============================================

Search UI and theme for the Discoverer search module

2.0.2(5mo ago)11.2k↓33.3%[2 issues](https://github.com/silverstripeltd/silverstripe-discoverer-search-ui/issues)1BSD-3-ClausePHPPHP ^8.3

Since Jul 30Pushed 5mo ago6 watchersCompare

[ Source](https://github.com/silverstripeltd/silverstripe-discoverer-search-ui)[ Packagist](https://packagist.org/packages/silverstripe/silverstripe-discoverer-search-ui)[ Docs](https://github.com/silverstripeltd/silverstripe-discoverer-search-ui)[ RSS](/packages/silverstripe-silverstripe-discoverer-search-ui/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (9)Dependencies (2)Versions (11)Used By (1)

🧭 Silverstripe Discoverer &gt; 🎨 Search UI
==========================================

[](#-silverstripe-discoverer---search-ui)

Provides a Silverstripe page type, search UI, and basic theme to get you started with your search implementation.

Installation
------------

[](#installation)

```
composer require silverstripe/silverstripe-discoverer-search-ui
```

Using this module
-----------------

[](#using-this-module)

The templates provided make some guesses as to what fields you might have defined for your search, but it's likely that some manual intervention will still be required on your part to help this search UI meet your use case.

### Search results page

[](#search-results-page)

This module comes out of the box with a `SearchResults` page which will be made available to you in the CMS. Simply create one of these pages on your website, and the `SearchResultsController` will take care of creating the search form and displaying results.

### Default fields

[](#default-fields)

This search UI assumes that you have the following fields available in your index:

- `title`
- `link`
- `content` (optional)
- `body` (optional)

Spelling suggestions (aka "did you mean")
-----------------------------------------

[](#spelling-suggestions-aka-did-you-mean)

**Not to be confused with Query suggestions (aka autocomplete).**

Spelling suggestions for queries can be enabled with the following environment variable.

```
SEARCH_SPELLING_SUGGESTIONS_ENABLED=1
```

Note: Spelling suggestions is an API query that happens **after** you have received results - so it will impact your page load times.

The spelling suggestions feature needs to know what fields you would like it to search in. By default, it **only**provides suggestions based on the `title` field. You can add additional fields by updating the following configuration.

```
SilverStripe\DiscovererSearchUI\Controller\SearchResultsController:
  spelling_suggestion_fields:
    - content
    - body
```

By default, these suggestions will be provided when you have zero (`0`) search results. This default can be updated through the following configruation.

```
SilverStripe\DiscovererSearchUI\Controller\SearchResultsController:
  result_count_for_spelling_suggestions: 5
```

By default, you will receive (up to) 1 suggestion (there aren't always spelling suggestions for a given query). This default can be udpated through the following configuration.

```
SilverStripe\DiscovererSearchUI\Controller\SearchResultsController:
  spelling_suggestions_limit: 5
```

Some services support both "raw" and "foramtted" results for spelling suggestions. Our default behaviour is to **not**request formatted suggestions. You can enable this in your requests through the following configuration.

```
SilverStripe\DiscovererSearchUI\Controller\SearchResultsController:
    spelling_suggestions_formatted: true
```

Customisations
--------------

[](#customisations)

The out of the box `SearchResultsController` comes with 4 extension points that will allow you to modify the search form, allow you to modify the query that is sent to your search service, and allow changing what index the query is sent to.

Create a new extension (for example):

```
