Skip to content

Instantly share code, notes, and snippets.

View nunomaduro's full-sized avatar

Nuno Maduro nunomaduro

View GitHub Profile
@nunomaduro
nunomaduro / scout_extended_with.php
Created December 19, 2018 13:38
Scout Extended With
<?php
$articles = Article::search('Star Trek')
->with([
'hitsPerPage' => 30,
'filters' => 'attribute:value',
'typoTolerance' => false,
])->get();
@nunomaduro
nunomaduro / scout_extended_settings_file.php
Created December 19, 2018 13:45
Scout Extended Settings File
<?php
return [
/*
|--------------------------------------------------------------------------
| Searchable Attributes
|--------------------------------------------------------------------------
|
| Limits the scope of a search to the attributes listed in this setting. Defining
@nunomaduro
nunomaduro / scout_extended_facade_client.php
Created December 19, 2018 13:46
Scout Extende Facade Client
<?php
use Algolia\ScoutExtended\Facades\Algolia;
$client = Algolia::client();
$apiKeys = $client->listApiKeys();
$indices = $client->listIndices();
$client->copyIndex('indexNameSrc', 'indexNameDest');
$client->moveIndex('indexNameSrc', 'indexNameDest');
@nunomaduro
nunomaduro / scout_extended_facades_analytics.php
Created December 19, 2018 13:50
Scout Extended Facades Analytics
<?php
use Algolia\ScoutExtended\Facades\Algolia;
$analytics = Algolia::analytics();
$test = $analytics->getABTest('a-unique-identifier');
// ...
@nunomaduro
nunomaduro / scout_extended_facades_client.php
Created December 20, 2018 14:26
Scout Extended Facades Client
<?php
use Algolia\ScoutExtended\Facades\Algolia;
$client = Algolia::client();
$apiKeys = $client->listApiKeys();
$indices = $client->listIndices();
$client->copyIndex('indexNameSrc', 'indexNameDest');
$client->moveIndex('indexNameSrc', 'indexNameDest');

This Pull Request introduces the upcoming Algolia API Client Python v2.

Preface

  • Follows 100% of the API Client v2 specs, just like PHP v2, c# v2: contains waitable response objects, up-to-date retry strategy, replace_all_objects,clear_objects, and more!

  • Supports Python: 2.7 🥳, 3.4, 3.5, 3.6, and 3.7.

  • Strong test suite, 100% test coverage on unittest (tests === 30secs locally! 🏎), flake8 (linter), and mypy (static-analysis) to ensure the quality of the code.

@nunomaduro
nunomaduro / upgrade-guide.md
Last active March 27, 2019 12:34
Python 2.0's upgrade-guide

Upgrading To 2.0.0 From 1.20.0

We attempt to document every possible breaking change. Since some of these breaking changes are in obscure parts of the API Client only a portion of these changes may actually affect your application.

Upgrade your algoliasearch dependency to >=2.0,<3.0 using pip:

pip install --pre algoliasearch 
<div class="content">
<div class="title m-b-md">
Laravel
</div>
<div id="app">
<!-- In a default Laravel app, Vue will render inside an #app div -->
<ais-instant-search
:search-client="searchClient"
index-name="{{ (new App\User)->searchableAs() }}"
<body>
<div class="content">
<div class="title m-b-md">
Laravel
</div>
<div id="app"><div class="ais-InstantSearch"></div></div>
<script src="/js/app.js"></script>
<script>
Vue warn]: Property or method "searchClient" is not defined on the instance but referenced during render. Make sure that this property is reactive, either in the data option, or for class-based components, by initializing the property. See: https://vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties.
(found in <Root>)
warn @ app.js:68765
warnNonPresent @ app.js:70178
has @ app.js:70223
(anonymous) @ VM153:3
Vue._render @ app.js:71676
updateComponent @ app.js:72192
get @ app.js:72603