Comments (7)
@AbdullahFaqeir Here's one possible solution: nicomengual@c95a89a
from laravel-scout-typesense-driver.
I was having this issue as well and found this in the documentation that helped:
https://laravel.com/docs/9.x/scout#conditionally-searchable-model-instances
from laravel-scout-typesense-driver.
I've run into this issue as well. This package does not adequately support what @MeisamMulla linked as the delete record method still fires, and if the record has not been created, as is the case in my application, it will throw an error.
I've submitted a PR to address this issue: #32
from laravel-scout-typesense-driver.
If you guys want to use this, you can update your composer.json
In require:
"typesense/laravel-scout-typesense-driver": "dev-patch-1"
Add or update your repositories:
"repositories": [
{
"type": "vcs",
"url": "https://github.com/BrandonJamesBorders/laravel-scout-typesense-driver"
}
]
Then run composer update
from laravel-scout-typesense-driver.
Hi @nicomengual
This solution should work for you: https://laravel.com/docs/9.x/scout#conditionally-searchable-model-instances
Just add following inside your model and return false whenever you don't want to sync that model.
/**
* Determine if the model should be searchable.
*
* @return bool
*/
public function shouldBeSearchable()
{
return $this->isPublished();
}
Let me know if this solves your problem.
Thanks.
from laravel-scout-typesense-driver.
@karakhanyans I think you're right with the shouldBeSearchable
solution, so I think this issue can be closed
from laravel-scout-typesense-driver.
Closing this issue due to provided solution.
from laravel-scout-typesense-driver.
Related Issues (20)
- Laravel 10 Support HOT 10
- Error from Typesense on Update of Model Instance which is not in index HOT 2
- PHP 8.2 deprecation warnings HOT 1
- Laravel Scout 10? HOT 1
- Unable to sort HOT 4
- Error importing document: Field `itemStocks` not found. HOT 2
- "Undefined property: Laravel\\Scout\\Builder::$whereIns", HOT 1
- Filter in typesensne collection of objects in Laravel
- $model->unsearchable(); does not work HOT 7
- Import not working with array data. HOT 11
- Model update resets document auto-generated embeddings HOT 1
- Cannot index collection with a soft deleted first model when scout.soft_delete is true HOT 2
- Hotfix TypeError - Typesense\\Documents::import(): Argument #1 ($documents) must be of type string, array given. HOT 5
- Undefined property: Laravel\Scout\Builder::$whereIns
- Passing "empty" values to search query results in "Parameter `q` is required"
- Please add possibility to use Laravel Scout Builder ->options() method
- Duplicate array keys in TypesenseEngine::buildSearchParams HOT 1
- Exception when searching large datasets for common query HOT 2
- Using Multi Search after merging to Laravel Scout HOT 2
- Typesense scout import fails in Laravel 11 HOT 1
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-typesense-driver.