Skip to content

Ability to use filters on index for additional searchparams/options #315

Open
@ToshY

Description

@ToshY

Notice
Backstory: I've been migrating majority of heavy-duty queries from Doctrine ORM to Meilisearch.

Description
I would like to the possibility to be able to create filters that would allow the search / rawSearch methods to have additional searchParams / options from these filters.

Basic example

Other
An example use-case for this is as follows:

  • Let's say I have authenticated and guest users.
  • Both these types of users can perform searches on the same index, but the authenticated users can have access to more results.
  • In order to achieve this, an additional field is added to the documents, e.g. freeTier.
    • The freeTier = 1 is available for guests and authenticated users.
    • The freeTier = 0 is explicitly available for authenticated users.
  • If the guest user seaches, it should add an additional filter to the searchParams which essentially would add AND (freeTier = 1) filter.
  • If the authenticated user searches, it should not add this additional filter as authenticated users are allowed to search for both freeTier values 0 and 1.

Now if similar, but not exact same, searches are performed on the same index, I'd still like it to take into consideration this freeTier = 1 field without manually concatenating this filter to every place a search on this index is performed. But with that in mind, if for some reason it is not desired to use the filter at a certain search, I should also have the possibility to disable/enable at any time.


The feature request boils down to a kind of Doctrine filters functionality for the Meilisearch search methods.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions