How to use whereNot in laravel scout - elasticsearch

I want to use whereNot in laravel scout search but it is not working. although where clause is working fine
Address::search("{$address->suburb}")->whereNot('id',$address->id)->get();
How i can do that?

You can directly do Full Text Search in AES. Read the Docs.
Laravel Scout comes with Algolia and MeiliSearch drivers but if you are writting your own driver for ElasticSearch, this link will help you in every aspect including WhereNot and all other clauses.
ES::type("my_type")->whereNot("status", "published")->get();
# or
ES::type("my_type")->whereNot("status", "=", "published")->get();

Related

AWS Open search in laravel 8

I need to implement AWS open search in laravel 8 did any one have idea how can we get this? any reference link or tutorial ? does any one have doing same before ?
I've implemented OpenSearch with a couple of projects on Laravel 9 recently.
Here is the instruction on how to install OpenSearch:
https://opensearch.org/docs/latest/opensearch/install/index/
And this is the really simple custom Laravel Scout engine you may use:
https://github.com/romangrinev/laravel-openseach-engine
For AWS open search in Laravel 8.x you can refer my custom package based on Laravel Scout engine.
https://github.com/tris-nm/laravel-scout-opensearch-engine
It's work well for my project with Amazon OpenSearch Service version 1.2

How use elastic in laravel app for search without eloquent?

I have a elastic instance where data format and insert by an other application.
I want search data from elastic with my laravel app without use eloquent.
what is the best way for that?
Thanks
For using a fulltext search you should use Laravel Scout. By default Laravel Scout is only shipped with one connector - Algolia. But you can write your own connector to any search engine preferred. There is a section in the Laravel Scout docs about custom search engines.
There already seems to be a working package babenkoivan/elastic-scout-driver, that connects Laravel Scout to Elastic Search.

Can I use scout with laravel 5.1

Given Laravel scout was introcuced with laravel 5.3 can I use it with laravel 5.1?
The docs at https://laravel.com/docs/5.3/scout doesn't state anything about this.
Yes you can include it in laravel 5.x as well , Using this blog
Blog Link
Also you can check Other Elastic Search plugin which are being used in laravel much before Scout
https://blog.madewithlove.be/post/integrating-elasticsearch-with-your-laravel-app/
https://github.com/cviebrock/laravel-elasticsearch
No It's not possible as laravel/scout required
illuminate/contracts: ~5.3
illuminate/database: ~5.3
illuminate/support: ~5.3
which is only available in laravel >=5.3

Customizing the paginator view in Laravel 5.2

I've been reading the docs and set up a basic app.
Every issue I've had before I've been able to solve by looking in the docs and occasionally using Google, however I can't figure this one out.
I'm using Laravel version 5.2.43 and the Paginator works fine.
I use it in my view like this,
$data->links()
But now I would like to customize the look of the paginator.
So I tried running this command
php artisan vendor:publish --tag=laravel-pagination
In the hopes of simply being able to customize that view instead of creating a new one all over but that command didn't work, it just said
Nothing to publish for tag [laravel-pagination]
So, instead I did this.
{{ $data->links('folder.viewName') }}
But this command gives me this error,
Argument 1 passed to Illuminate\Pagination\LengthAwarePaginator::links() must be an instance of Illuminate\Contracts\Pagination\Presenter, string given
So I'm not sure what's going on. The pagination works but I can't set the view myself.
Any thoughts on what's going on here?
Any help would be greatly appreciated.
I believe you can't do this in Laravel 5.2 without "hacking" the framework. Fortunately, Laravel 5.3 is released this week and it features custom pagination views
Custom pagination in Laravel 5.3
So it turns out I've been reading the 5.3 documentation for Laravel all this time. Which explains a lot of things...
So when 5.3 comes out we can do
$paginator->links("myOwnView")
Until then, I've done it the manual way of using the instances inside the paginator object.

Laravel debugger duplicate queries

I am a newbie at Laravel and trying to figure out Laravel 4.2 and sentry 2.1. Also I am using laravel debugger by https://github.com/barryvdh/laravel-debugbar . While debugging after user logs in I get a 6 queries and a message like this:
So I am not sure why is the second query duplicated, does maybe anyone has experience with this? I googled the problem but no answer.
I made a deeper search and found that was a bug in sentry 2.1 and planned to be fixed in next version, probably sentinel. https://github.com/cartalyst/sentry/issues/269

Resources