Skip to content

Conversation

@ankita-gupta21
Copy link
Contributor

Issue

https://gravitee.atlassian.net/browse/APIM-11728

Description

Fixes decodeQueryFilters to properly handle parentheses and maintain correct AND/OR precedence when parsing filter queries.

Additional context

  • Fix decodeQueryFilters to properly split AND segments before processing OR
  • Remove outer parentheses from segments before parsing
  • Handle OR conditions within AND segments correctly
  • Resolve issue where parentheses were included in split results

Fixes parsing of queries like:

  • (api:123) AND (status:200) → ["api:123", "status:200"]
  • (api:123) AND (status:200 OR status:429) → ["api:123", "status:200", "status:429"]

Before Fix

APIM-11728_Before-fix.mov

After Fix

Screen.Recording.2025-11-04.at.10.25.25.AM.mov

@ankita-gupta21 ankita-gupta21 requested a review from a team as a code owner November 4, 2025 06:35
@gemini-code-assist
Copy link

Summary of Changes

Hello @ankita-gupta21, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request resolves a critical issue in the log filtering mechanism by refining how complex queries involving parentheses and AND/OR logic are parsed. The changes ensure that filter conditions are correctly interpreted and applied, leading to more accurate and reliable log search results. Additionally, related UI components have been updated to handle array structures consistently and provide clearer user feedback.

Highlights

  • Improved Query Parsing Logic: The decodeQueryFilters function has been enhanced to correctly interpret complex log filter queries, specifically addressing issues with parentheses and the precedence of AND/OR operators.
  • Array Flattening for Filter Values: A new utility method, flattenArray, was introduced and integrated into the search-and-select component to ensure that filter values (like api, application, and status) are always stored as flat arrays, preventing nested array structures that could arise from complex query parsing.
  • Enhanced UI Feedback for Search and Select: The search-and-select component now provides more accurate feedback to users, displaying 'No options available' when the options list is empty and no search term is active, rather than a generic 'Loading...' message.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@ankita-gupta21 ankita-gupta21 force-pushed the APIM-11728-Applied-Filter-Tags-Disappear-in-Log-View branch 2 times, most recently from 8bcc251 to 732e574 Compare November 4, 2025 06:37
Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request effectively fixes the query parsing for filters involving parentheses and complex AND/OR logic. The changes in logs-filters.controller.ts correctly handle the aggregation of filter values, and the defensive array flattening in search-and-select.controller.ts enhances the component's robustness. I've noted a potential issue in the filter value parsing that could lead to incorrect behavior, and I've also suggested a performance optimization for array handling. Please see my detailed comments below.

@ankita-gupta21 ankita-gupta21 force-pushed the APIM-11728-Applied-Filter-Tags-Disappear-in-Log-View branch 2 times, most recently from 7796643 to eb1cdf9 Compare November 4, 2025 08:56
@ankita-gupta21 ankita-gupta21 force-pushed the APIM-11728-Applied-Filter-Tags-Disappear-in-Log-View branch from 185efa8 to 3c9b6f6 Compare November 4, 2025 09:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants