Reputation: 2687
I am trying to build a search feature that will allow users to search through all the files they have access to. So far I have tryied to use Scout, but it does not seem to be made for those kind of complex requests. Many examples I see about Scout are mostly trivial, for example, the use case where you have a blog and you want to search for a blog article by name without the unpublished articles. But that does not depend on the logged in user's access priviledges. What about the cases where you might have different indexes depending on the user searching?
Here is a concrete example of what I am looking to implement.
In this image, we show users having access to different projects and projects having multiple files in them. In this example, user W has access to project A and project B, and thus have access to file A to E. When the user W searches on the web application, never should the file F come out in the search results.
Is Laravel Scout a good candidate to this kind of advanced search feature?
If not, how do you implement such feature? Where should I be looking for to get started?
Upvotes: 3
Views: 421
Reputation: 2769
I believe you don't need multiple indices in your case. Just add 'project_name field' to your file doc or generate multiple fields like project_a: true
. And then build search like File::search('project_a = true')
You can use this package to build complex queries or even search through multiple indices https://github.com/matchish/laravel-scout-elasticsearch
Upvotes: 0