Skip to content
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

Filtering by tags in query list is not working #4557

Closed
nason opened this issue Jan 17, 2020 · 13 comments · Fixed by #4563
Closed

Filtering by tags in query list is not working #4557

nason opened this issue Jan 17, 2020 · 13 comments · Fixed by #4563
Assignees

Comments

@nason
Copy link
Contributor

nason commented Jan 17, 2020

Issue Summary

A summary of the issue and the browser/OS environment in which it occurs.

Steps to Reproduce

  1. Go to /queries
  2. Select a tag in the sidebar

I expect the queries list to filter by the selected tags, but this does not appear to be happening.

Technical details:

  • Redash Version: 9.0.0-alpha (b5bfad0547ba04ed1ba0ad7ea17631e0e2b9846)
  • Browser/OS: Chrome / MacOS
  • How did you install Redash: Docker
@arikfr
Copy link
Member

arikfr commented Jan 19, 2020

@kravets-levko @gabrieldutra at first I thought it's a backend issue, but this doesn't happen in the SaaS repo. Can it be related to one of he latest React changes? Maybe the Axios one?

@kravets-levko
Copy link
Collaborator

kravets-levko commented Jan 19, 2020

@arikfr Yes, seems it's related to Axios: it serializes arrays in a different way comparing to Angular:

  • Angular (works fine): /api/queries?tags=Tag1&tags=Tag2
  • Axios (doesn't work): /api/queries?tags[]=Tag1&tags[]=Tag2

When [] removed - filter by tags works.

@arikfr
Copy link
Member

arikfr commented Jan 19, 2020

@kravets-levko is this something we can easily control? Otherwise we can update the backend to support it.

@kravets-levko
Copy link
Collaborator

Seems yes. I'll explore it a bit later (need to finish some work I already started)

@gabrieldutra
Copy link
Member

gabrieldutra commented Jan 20, 2020

I checked in here, it seems we can change the serializer axios uses (we can pass it as a default config in the instance defined in axios.js):

{
  paramsSerializer: params => qs.stringify(params),
}

For qs I tested the query-string lib that's already being used in the Router PR and looks like it translated the arrays without the brackets by default 🙂.

LMK if you want me to push those changes or in case you already had another idea.

@nason
Copy link
Contributor Author

nason commented Jan 20, 2020

Thanks for the quick fix! Great work y'all

@kravets-levko
Copy link
Collaborator

Quick bug - quick fix 😎

@ptsilva
Copy link

ptsilva commented Feb 4, 2020

I think that this fix causes a bug in multi tag filter. I tried here and it's easy to reproduce.

@gabrieldutra
Copy link
Member

I think that this fix causes a bug in multi tag filter. I tried here and it's easy to reproduce.

Can you provide more details? (e.g: in which url you tried it and what exactly happened)

It looks like it's working in our preview environment

@ptsilva
Copy link

ptsilva commented Feb 4, 2020

issue

@ptsilva
Copy link

ptsilva commented Feb 4, 2020

It's not a bug, inspecting the source code, i seen that is used "contains" filter at:

cast(column, postgresql.ARRAY(db.Text)).contains(tags)

I was expecting "any" behavior of tags filtering

Thanks

@gabrieldutra
Copy link
Member

@ptsilva, yes, it evaluates as an "AND" 😅, I agree that the UI doesn't help much on reflecting the behavior (related: #2955), but in terms of the feature, in my personal experience it was much more valuable to have it working as is (with the "contains").

The scenario I had: more than 2k queries and needed a way to build a "Query Search" (text search is far too difficult in here). The combine tags search came in handy for this purpose as people could just go combining query tags to find their queries.

Anyway, I think it makes sense to have a more robust search with more filtering options in the future.

@ptsilva
Copy link

ptsilva commented Feb 4, 2020

Interesting.. Perhaps adding "AND" or "+" between selected tags in not found message could reduce doubts related with tag filtering. But Anyway thanks for your reply!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants