Algolia Search
This plugin integrates the Algolia Search API to the OctoberCMS.
Algolia Search
This plugin integrates the Algolia Search API to the OctoberCMS.
With this plugin you can simply search blog posts or products and display the search results using Algolia search service.
Installation via Command Line
php artisan plugin:install Xeor.Algolia
Quick Start
The following code adds search capabilities to your Post model creating a Post index:
...
use AlgoliaSearch\Laravel\AlgoliaEloquentTrait;
class Post extends Model
{
use AlgoliaEloquentTrait;
...
}
Components
| Name | Page variable | Description |
|---|---|---|
| Search | {% component 'search' %} |
Outputs the search form |
Search Component
Properties
| Property | Description | Example Value | Default Value |
|---|---|---|---|
| applicationID | This is your unique application identifier. It is used to identify yourself to our API | P6NQJRS491 | - |
| apiKey | This is the public API key to use in your front-end code. This key is only usable for search queries | 63a7291636e66f17399befdd79ac8abc | - |
| index | Index name | articles | blog |
Variables available in templates
{{ applicationID }}{{ apiKey }}{{ index }}
Example:
<input class="autocomplete" type="text" placeholder="Start typing" id="autocomplete-algolia" spellcheck="false"/>
<script src="https://cdn.jsdelivr.net/autocomplete.js/0/autocomplete.jquery.min.js"></script>
<script type="text/javascript">
(function($){
$(document).ready(function() {
var client = algoliasearch('{{ applicationID }}', '{{ apiKey }}');
var index = client.initIndex('{{ index }}');
$('#autocomplete-algolia').autocomplete(null, {
source: $.fn.autocomplete.sources.hits(index),
displayKey: 'Title'
});
});
})(jQuery);
</script>
Learn more about Algolia Search API Client for Laravel and Algolia Search API Client for JavaScript.
Console Commands
$ php artisan algolia:clear Rainlab.Blog Post $ php artisan algolia:reindex Rainlab.Blog Post --safely=true
-
Rodrigo Galter
Não está funcionando na última versão do october.
-
Sozonov Alexey author
Hello! Can you provide more info?
-
| 1.0.3 |
Update console commands Feb 16, 2019 |
|---|---|
| 1.0.2 |
Make compatible with Laravel 5.4 Feb 16, 2019 |
| 1.0.1 |
First version of Algolia Search Plugin Jan 07, 2017 |