Comments (10)
I don't know, we miss something. Okay. Let's look at the problem again from scratch.
The problem is caused by the fact that there are 2 Form classes in the same namespace. And You changed one of the names. But somehow, more is needed to solve the problem. You may need to give more clues to understand the problem. And I checked the codebase of this library. There is no class as Form. According to my understanding, the issue is beyond the scope of the library.
If you can give more information, we can reconsider the issue.
from laravel-scout-elasticsearch.
I change driver to anouther "algolia",but still so.The configuration file doesn't seem to be working
from laravel-scout-elasticsearch.
I guess one of your model using this Form class name some how. Find the line in your models and could you change "Encore\Admin\Form as Form" part as "Encore\Admin\Form as AdminForm" and use "AdminForm" instead of "Form" in that file.
from laravel-scout-elasticsearch.
我猜你的模型之一使用这个 Form 类名称是如何的。找到模型中的行,您是否可以将“Encore\Admin\Form as Form”部分更改为“Encore\Admin\Form as AdminForm”,并在该文件中使用“AdminForm”而不是“Form”。
NO!Are there any other solutions?thx
namespace App\Models;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
use Illuminate\Database\Eloquent\Relations\HasMany;
use Laravel\Scout\Searchable;
use Overtrue\LaravelPinyin\Facades\Pinyin;
class Concert extends Model
{
use Searchable;
public function searchableAs(): string
{
return 'concerts_index';
}
public function toSearchableArray(): array
{
$this->loadMissing(['people']);
return [
'name' => $this->name,
'name_pinyin' => implode(' ', Pinyin::convert($this->name)),
'people' => $this->people->pluck('name')->implode(','),
'people_pinyin' => $this->people->pluck('name')->transform(function ($name) {
return [implode(' ', Pinyin::convert($name)), Pinyin::abbr($name)];
})->toArray()
];
}
public function shouldBeSearchable(): bool
{
return $this->enabled;
}
}
from laravel-scout-elasticsearch.
yes
composer.json
{
"name": "laravel/laravel",
"type": "project",
"description": "The skeleton application for the Laravel framework.",
"keywords": ["laravel", "framework"],
"license": "MIT",
"require": {
"php": "^8.1",
"aoeng/laravel-admin-advertisement": "^1.0",
"aoeng/laravel-admin-article": "^1.0",
"aoeng/laravel-admin-filesystem": "^1.2",
"aoeng/laravel-admin-version": "^1.0",
"encore/laravel-admin": "1.*",
"guzzlehttp/guzzle": "^7.2",
"iidestiny/laravel-filesystem-oss": "^3.3",
"laravel-admin-ext/latlong": "1.x",
"laravel/framework": "^10.10",
"laravel/sanctum": "^3.2",
"laravel/scout": "*",
"laravel/tinker": "^2.8",
"leonis/easysms-notification-channel": "^2.0",
"matchish/laravel-scout-elasticsearch": "^7.4",
"overtrue/laravel-pinyin": "^5.0",
"overtrue/laravel-socialite": "^4.0",
"propaganistas/laravel-phone": "^5.0"
},
"require-dev": {
"fakerphp/faker": "^1.9.1",
"knuckleswtf/scribe": "^4.25",
"laravel-lang/common": "^4.0",
"laravel/pint": "^1.0",
"laravel/sail": "^1.18",
"mockery/mockery": "^1.4.4",
"nunomaduro/collision": "^7.0",
"phpunit/phpunit": "^10.1",
"spatie/laravel-ignition": "^2.0"
},
"autoload": {
"psr-4": {
"App\\": "app/",
"Database\\Factories\\": "database/factories/",
"Database\\Seeders\\": "database/seeders/"
}
},
"autoload-dev": {
"psr-4": {
"Tests\\": "tests/"
}
},
"scripts": {
"post-autoload-dump": [
"Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
"@php artisan package:discover --ansi"
],
"post-update-cmd": [
"@php artisan vendor:publish --tag=laravel-assets --ansi --force"
],
"post-root-package-install": [
"@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
],
"post-create-project-cmd": [
"@php artisan key:generate --ansi"
]
},
"extra": {
"laravel": {
"dont-discover": []
}
},
"config": {
"optimize-autoloader": true,
"preferred-install": "dist",
"sort-packages": true,
"allow-plugins": {
"pestphp/pest-plugin": true,
"php-http/discovery": true
}
},
"minimum-stability": "stable",
"prefer-stable": true
}
models
just one
namespace App\Models;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
use Illuminate\Database\Eloquent\Relations\HasMany;
use Laravel\Scout\Searchable;
use Overtrue\LaravelPinyin\Facades\Pinyin;
class Concert extends Model
{
use Searchable;
public function searchableAs(): string
{
return 'concerts_index';
}
public function toSearchableArray(): array
{
$this->loadMissing(['people']);
return [
'name' => $this->name,
'name_pinyin' => implode(' ', Pinyin::convert($this->name)),
'people' => $this->people->pluck('name')->implode(','),
'people_pinyin' => $this->people->pluck('name')->transform(function ($name) {
return [implode(' ', Pinyin::convert($name)), Pinyin::abbr($name)];
})->toArray()
];
}
public function shouldBeSearchable(): bool
{
return $this->enabled;
}
}
scout.php
'driver' => env('SCOUT_DRIVER', 'null'),
.env
,but change auouth one ,still so,config like not working.
SCOUT_DRIVER=Matchish\ScoutElasticSearch\Engines\ElasticSearchEngine
system ubuntu,It is working in windows.
Can you repeat the question?
Do you need anything else?
from laravel-scout-elasticsearch.
info('Stmts: ' ,[$stmts]);
return $nodeTraverser->traverse($stmts);
It seems to print out all my php code
What happened?
from laravel-scout-elasticsearch.
I just tried with your sharing :
Importing [App\Models\Concert]
Switching to the new index
5/5 [⚬⚬⚬⚬⚬⚬⚬⚬⚬⚬⚬⚬⚬⚬⚬⚬⚬⚬⚬⚬⚬⚬⚬⚬⚬⚬⚬⚬] 100%
[OK] All [App\Models\Concert] records have been imported.
Everything works fine for me. I guess there should be a People model somewhere. And that model uses something related to Form.
It seems to print out all my php code
What happened?
This library loops on your project file to find the Models which are Searchable. And import them. You can check the Matchish\ScoutElasticSearch\Console\Commands\ImportCommand
as well.
from laravel-scout-elasticsearch.
change app/Admin/bootstap.php
use Encore\Admin\Form as AdminForm;
use Encore\Admin\Grid as AdminGrid;
It looks good.
from laravel-scout-elasticsearch.
Search all files This design is a little anti-human,Is it that I give you something, and you import it?
from laravel-scout-elasticsearch.
I am afraid I could not understand exactly what you mean but you can feel free to raise a PR with better solution as well. That part just looping to find classes which are using Searchable trait to be able import it into ES.
from laravel-scout-elasticsearch.
Related Issues (20)
- [Feature] Change app namespace call in commands HOT 2
- [BUG] Call to a member function toCodeString() on null HOT 5
- [BUG] Bulk update error when saving with boolean HOT 1
- [BUG] NoNodeAvailableException: No alive nodes. All the 1 nodes seem to be down HOT 3
- [BUG] The attribute [routing] either does not exist or was not retrieved for model [App\Models\Track]. HOT 5
- [BUG] Possibly unexpected behaviour, when using additional callback in `search` HOT 3
- [Feature] Utilize custom "options" of a builder HOT 2
- configure stopwords HOT 1
- "current.health":"RED","message":"Cluster health status changed from [YELLOW] to [RED] HOT 1
- [BUG] ProgressBar updates are posted to stderr HOT 1
- [BUG] Class Elasticsearch\Client not found HOT 3
- [Feature] Add possibility to use RangeQuery and other terms instances as value for $scoutQuery->where() HOT 2
- [Feature] Use SearchableScope instead PageScope HOT 4
- PHP 8.3 support HOT 2
- is there any way to revert to the previous index state before reindexing ? HOT 3
- Elastic has prefix restrictions on reads HOT 1
- How to use the latest version of this package with Elasticsearch 7? HOT 3
- PHP-Parser not in direct dependencies, PHP-Parser > 5.0 is incompatible HOT 1
- Why Can't I update the mapping with Laravel Scout?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from laravel-scout-elasticsearch.