Comments (5)
Hey @milosevicn,
the ->toSearchableArray()
defines the stored data within MeiliSearch for a specific document (object). Omitting the id
will result in non-discoverable elements within the search because by default the id
is the primary key used for identifing a document.
To prevent MeiliSearch from searching through all fields, consider extending the functionallity of this package and setting the searchAttributes
within MeiliSearch. You can find a tutorial to do this here.
from meilisearch-laravel-scout.
@mmachatschek Sorry to disturb you, but I didn't want to open new issue for this. It might be related to my question up there.
When I'm adding documents using php artisan scout:import
command, everything works as it's supposed to, but when I am doing the same using /indexes/:index_uid/documents
route (->addDocuments()
) it does not respect toSearchableArray()
rules. So if I try adding the whole model, all columns are going to be added.
I would probably be able overcoming this by selecting specific columns while doing query, but is there a way to make the function addDocuments()
itself be aware of toSearchableArray()
?
from meilisearch-laravel-scout.
Hi @milosevicn,
this package basically is a wrapper for the MeiliSearch PHP library and extends Laravel Scout.
When adding documents "manually", all the magic that Scout provides e.g. adding new objects to the index or updating existing ones with specific fields etc. gets lost because you skip that steps.
Is there a specific intention you have by adding documents manually?
from meilisearch-laravel-scout.
Thanks for replying @mmachatschek
I have multitenancy app - two separate apps (landlord and tenant). Because of this, I am not able to use predefined Laravel Scout functionality to update docs automatically once something is added to database. That's why I'm using a webhook to inform my tenant app when something happened in database actually on landlord (on created/updated/deleted). I want to add those docs once I catch a webhook on tenant
from meilisearch-laravel-scout.
@milosevicn I think you could just do a $model->touch()
. This updates the updated_at column of the model and the updated
event will be triggered on the tenant app. The Scout event listener will then trigger a update on the index. Would this work out for you?
from meilisearch-laravel-scout.
Related Issues (20)
- search()->get() returns a maximum of 20 items HOT 1
- A primary key is already present. It's impossible to update it HOT 2
- using FacetFilters HOT 3
- cant find any good example tutorial ,correct me if iam doing wrong HOT 4
- The future of this repo HOT 17
- Delay for index new records HOT 1
- [DX] Easy index configuration HOT 2
- Creating index using php artisan not working HOT 7
- cant use toSearchableArray method HOT 3
- Include facetsDistribution in paginate() response? HOT 1
- How to deploy and use laravel-scout and Meilisearch to ec2 instance HOT 5
- Update of existing records HOT 4
- Downgrading Meilisearch to version compatible with database HOT 1
- Engine uses the eloquent getScoutKey() to get key values but uses getKeyName() to get the name of the key HOT 2
- Getting an error when meilisearch service is not run HOT 1
- How to setup a custom timeout for a search ? HOT 8
- paginateRaw() returns wrong amount of total items HOT 4
- Laravel native support announced HOT 1
- One Model not importing HOT 3
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 meilisearch-laravel-scout.