Skip to content

Commit

Permalink
Setup version 3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronbushnell committed Jun 29, 2021
1 parent 4cdecdb commit 9fb0d47
Show file tree
Hide file tree
Showing 5 changed files with 3,535 additions and 829 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# Release Notes for Algolia

## 3.0.0 - 2021-06-29

### Added
* Helper to convert an object of filters into the stringified Algolia syntax for filtered searches

### Changed
* Algolia PHP SDK updated to 3.x
* PHP 7.1+ required
* Craft 3.1.19+ required

## 2.0.0 - 2019-03-15

Initial Craft 3 release
28 changes: 27 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,32 @@ Algolia for Craft CMS allows you to easily pull search results from Algolia into
{% endfor %}
```

### Parsing filters

When using filters in an Algolia search the engine requires [a particular syntax](https://www.algolia.com/doc/api-reference/api-parameters/filters/). Rather than stringifying your filters in Twig this plugin offers a way to convert an object like...

```json
{
food: ['fries', 'cake', 'pizza'],
colors: ['blue', 'green', 'red'],
featured: true
}
```
to a valid Algolia filter string like...
```
'(food:"fries" OR food:"cake" OR food:"pizza") AND (colors:"blue" OR colors:"green" OR colors:"red") AND (featured:"1")'
```

```twig
{% set filters = {
food: ['fries', 'cake', 'pizza'],
colors: ['blue', 'green', 'red'],
featured: true
} %}
{{ craft.algolia.parseFilters(filters) }}
```

## Using JSON REST API controllers
In additional to Twig variables you can make a `POST` request to one of the following controller endpoints. The same index, query and optional attributes are available when you make your `POST` request.

Expand Down Expand Up @@ -138,7 +164,7 @@ axios.post("/actions/algolia/default/multiple-queries", {

## Requirements

This plugin requires Craft CMS 3.0.0-beta.23 or later.
This plugin requires Craft CMS 3.1.19+ and PHP 7.1+.

## Installation

Expand Down
8 changes: 5 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "trendyminds/algolia",
"description": "Easily pull search results from Algolia into your Craft CMS website",
"type": "craft-plugin",
"version": "2.0.0",
"version": "3.0.0",
"keywords": [
"craft",
"cms",
Expand All @@ -22,8 +22,10 @@
}
],
"require": {
"craftcms/cms": "^3.0.0-RC1",
"algolia/algoliasearch-client-php": "^2.2"
"php": ">=7.1",
"craftcms/cms": "^3.1.19",
"algolia/algoliasearch-client-php": "^3.0",
"tightenco/collect": "^5.8|^6.0|^7.0"
},
"autoload": {
"psr-4": {
Expand Down
Loading

0 comments on commit 9fb0d47

Please sign in to comment.