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

Enhancement: Multi-Tag Filtering and Search Functionality #1367

Merged
merged 5 commits into from
Aug 7, 2023

Conversation

ObaydaAlesawi
Copy link
Contributor

Description:

This Pull Request proposes the introduction of a significant enhancement to the existing search functionality in the Telescope. Specifically, it enables users to filter and search using multiple tags simultaneously for requests.

Why is this change necessary?

The current tag-based search and filter system only allows one tag per search. With the new multi-tag search and filtering, users can have more granular control over their search results, allowing for a more thorough and precise search experience.

@crynobone
Copy link
Member

crynobone commented Aug 1, 2023

Overall this looks good, but do have concern whether someone might already using , in custom tags since Telescope doesn't sanitize the value at the moment.

taylorotwell and others added 3 commits August 1, 2023 14:00
Co-authored-by: Mior Muhammad Zaki <crynobone@gmail.com>
Co-authored-by: Mior Muhammad Zaki <crynobone@gmail.com>
Co-authored-by: Mior Muhammad Zaki <crynobone@gmail.com>
@ObaydaAlesawi
Copy link
Contributor Author

Overall this looks good, but do have concern whether someone might already using , in custom tags since Telescope doesn't sanitize the value at the moment.

I'm not convinced that's the standard way to insert a tag, but how about this approach:
If a tag contains a comma , the user should format their search like this -
"tag1,data", tag2, tag3.
What are your thoughts on this? @crynobone

@taylorotwell
Copy link
Member

I would be ok with that @Algeneralo

We can also just let it roll like this for now.

@taylorotwell taylorotwell merged commit 095cd0e into laravel:4.x Aug 7, 2023
@ObaydaAlesawi ObaydaAlesawi deleted the patch-1 branch August 9, 2023 10:57
@faustoFF
Copy link

faustoFF commented Oct 5, 2024

After making this change, I found that filtering by tag is extremely slow on a "large" database (I have a ~20GB separate Telescope database in MariaDB). The Telescope web interface hits a 504 error (after 1 minute of waiting) when filtering. I found that the database takes a long time to execute this query:

select 
  * 
from 
  `telescope_entries` 
where 
  `type` = ? 
  and `uuid` in (
    select 
      `entry_uuid` 
    from 
      `telescope_entries_tags` 
    where 
      `entry_uuid` in (
        select 
          `entry_uuid` 
        from 
          `telescope_entries_tags` 
        where 
          `tag` in (?)
      )
  ) 
order by 
  `sequence` desc 
limit 
  50

I believe the second IN clause contains a redundant subquery, and the resulting query should be optimized and simplified to:

select 
  * 
from 
  `telescope_entries` 
where 
  `type` = ? 
  and `uuid` in (
    select 
      `entry_uuid` 
    from 
      `telescope_entries_tags` 
    where 
      `tag` in (?)
  ) 
order by 
  `sequence` desc 
limit 
  50

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

Successfully merging this pull request may close these issues.

4 participants