-
Notifications
You must be signed in to change notification settings - Fork 37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Not able to skip an object from being indexed #24
Comments
This allows the current object to be skipped, just by returning false, empty array or null in the toSearchableArray method of the model. Ref to issue: typesense#24
@AbdullahFaqeir Here's one possible solution: nicomengual@c95a89a |
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 |
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 |
If you guys want to use this, you can update your composer.json In require: Add or update your repositories:
Then run |
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.
Let me know if this solves your problem. Thanks. |
@karakhanyans I think you're right with the |
Closing this issue due to provided solution. |
Description
Problems when trying to skip an object so it DOES NOT become part of the index. There's no apparent way to do it using the function
toSearchableArray
Steps to reproduce
The problem seems to be the function toSearchableArray
if I want to bypass an object on that function (ie: I don't want it into the index):
1- Returning an empty array results in a malformed JASON error when syncing:
2- Returning FALSE results in an error of unexpected response type:
3- if I use the Scout method 'unsearchable()' function results in an ObjectNotFound exception:
Expected Behavior
Ideally, if we would like this to work like Algolia does with Laravel Scout, by using the
unsearchable
method and returning either an empty array or a false flag, we would be able to skip the object from being added to the index.Actual Behavior
The import is interrupted with one of those exceptions and the collection is being indexed only up to the point of the first failure.
Metadata
Typsense Version: 0.2.22
OS: Ubuntu 22.04
The text was updated successfully, but these errors were encountered: