Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 12 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,27 @@

Provides support for integrating Typesense search with NSW websites

## Requirements
## Usage

* [Documentation](./docs/en/001_index.md)
* Add a hero search element to a page
* Save as draft
* Test search
* Publish the page

## Installation

```sh
composer require nswdpc/waratah-typesense
```

## License

[BSD-3-Clause](./LICENSE.md)

## Documentation

* [Documentation](./docs/en/001_index.md)

## Configuration

> Add project configuration examples
This module relies on a functional Typesense search server setup.

## Maintainers

Expand Down
8 changes: 1 addition & 7 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,12 @@
"role": "Developer"
}
],
"repositories": [
{
"type": "vcs",
"url": "https://codeberg.org/codemdev/silverstripe-typesense.git"
}
],
"support": {
"key": "value"
},
"require": {
"nswdpc/waratah": "^2",
"nswdpc/silverstripe-typesense-elemental": "dev-main",
"nswdpc/silverstripe-typesense-elemental": "dev-feat-decouple-client",
"silverstripe/asset-admin": "*",
"silverstripe/linkfield": "*",
"silverstripe/framework": "^5",
Expand Down
35 changes: 35 additions & 0 deletions docs/en/001_index.md
Original file line number Diff line number Diff line change
@@ -1 +1,36 @@
# Documentation

## Administrators

Ensure the project has a functioning Typesense search implementation with appropriate API keys and search server endpoints set up.

## Authors

1. Ensure a 'Typesense search page' is created and available
1. Create a page
1. Add a 'Hero Search (NSWDS)' element to the top content area of a page, configure it
1. Save the page
1. Test search
1. Publish the page

### Hero search element

In this element you can configure a search form and render it using the NSW Design System "Hero Search" component. The Hero Search element lives in the "Top content" area of a page.

You can:
1. Add a title, optionally displayed
2. Add a sub title
3. Add search links for popular items
4. Add optional quick search terms, a visitor can click on search term and view the results
5. Add a background image for the component
6. Configure a search results page - when someone searches for a keyword, results will display on this page.

### Instantsearch

This module supports Typesense instantsearch via a scoped search key. You administrator can set this up for you.

Once this is configured, the hero element will have one or more instant search configurations to choose from in the "Instantsearch" tab (behind the 3-dots menu on the right of the element view). Choose a configuration, save and then when happy publish.

When someone types in the search field of the hero element, a list of found records is displayed. Clicking on or hitting enter on a search result listed will take the user to the linked page relevant to the result.

> Instantsearch setup requires your site administrator to have a working understanding of Typesense scoped searches.
2 changes: 1 addition & 1 deletion src/Extensions/SiteTreeExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
use SilverStripe\Core\Extension;

/**
* Waratah smarts for the advanced search form
* Provides an extension to manage SiteTree search and results
* @extends \SilverStripe\Core\Extension<(\SilverStripe\CMS\Model\SiteTree & static)>
*/
class SiteTreeExtension extends Extension
Expand Down
1 change: 1 addition & 0 deletions src/Forms/AdvancedSearchForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

/**
* Waratah smarts for the advanced search form
* triggers the FilterForm handling on the advanced search form
*/
class AdvancedSearchForm extends BaseAdvancedSearchForm
{
Expand Down