documentation icon indicating copy to clipboard operation
documentation copied to clipboard

Add a filter syntax validator

Open curquiza opened this issue 3 years ago • 6 comments

I know this is not the priority and it involves tech people working on this, but it should be definitely a great addition, so I don't want we forget it 😇

We could have a filter syntax validator as Algolia did.

I ping @irevoire who already did a playground to test filter 😄

curquiza avatar Nov 09 '21 10:11 curquiza

If we want a filter syntax validator it is different than just using the response answers from MeiliSearch. MeiliSearch also returns errors based on the absence of a certain field in the filterableAttributes that would not be relevant in the case of a syntax validator. So it might be tricky, unless we make a playground on a certain dataset

bidoubiwa avatar Nov 09 '21 10:11 bidoubiwa

Yes, the playground of tamo is not the same as the syntax validator, it's true. Sorry for the ping tamo! However, a syntax validator is still a good idea I think 😇 but not a priority of course!

curquiza avatar Nov 09 '21 11:11 curquiza

Wouldn't it be more relevant to have this in the mini-dashboard where it allows to check on real data and display the results that match the filters?

gmourier avatar Nov 09 '21 14:11 gmourier

I don't know if the mini dashboard is planned to be improved because of the SaaS

curquiza avatar Nov 09 '21 14:11 curquiza

If we want a filter syntax validator it is different than just using the response answers from MeiliSearch. MeiliSearch also returns errors based on the absence of a certain field in the filterableAttributes that would not be relevant in the case of a syntax validator. So it might be tricky, unless we make a playground on a certain dataset

Actually, in the rewrite of the filter, all the filter-related errors have the same syntax. So when an error happens because you forgot to make one of your fields filterable you still get a well-formatted error. Eg: image

EDIT: Oops, my bad I just understood what you meant. Yeah to make a simple syntax validator we can’t make calls to a meilisearch instance. Right now we could integrate the filter errors in the mini-dashboard (and I think it would be a great idea because it would allow people to see what they can do really fast). But to integrate a simple syntax validator in the documentation I would need to export something else, like convert my crate to wasm and make it a npm library or something like that

irevoire avatar Nov 09 '21 14:11 irevoire

But to integrate a simple syntax validator in the documentation I would need to export something else, like convert my crate to wasm and make it a npm library or something like that

🤩

bidoubiwa avatar Nov 10 '21 10:11 bidoubiwa

After reading the discussion, I have the impression there are two different understandings of what a filter syntax validator should be.

  1. What Algolia has on their website seems to be a naïve syntax checker. It doesn't seem to be connected to an Algolia instance and does not return errors for e.g. attributes not present in the filterableAttributes list.
  2. A more complex validator reliant on Meilisearch errors and thus somehow connected to a Meilisearch instance (possibly via wasm).

Option 2 seems extremely complex and time consuming. I might be wrong, but it seems like too much energy for little benefit to users.

Option 1 seems feasible, though I have some concerns regarding keeping the validator up to date when the de facto maintainers are an external team.

I will pursue option 1 with basement. To avoid splitting the discussion in two places, I will close this issue and track it in their preferred tool. I will keep you updated about progress on this via the monthly docs website report.

guimachiavelli avatar Aug 02 '23 10:08 guimachiavelli