Skip to content

Conversation

yoshiokatsuneo
Copy link
Contributor

@yoshiokatsuneo yoshiokatsuneo commented Sep 27, 2025

What type of PR is this?

  • Feature

Description

Before the PR, when multi byte search is enabled, query search only support "ILIKE" based filtering. There is no way to search multiple terms, queries.

This PR make it possible to search query by specifying column name, exact match, multiple term AND search.

For example:
- word
- name:word
- query:word
- "multiple words"
- name:"multiple words"
- word1 word2 word3
- word1 "multiple word" query:"select foo"

How is this tested?

  • Manually
image image image image image

@yoshiokatsuneo yoshiokatsuneo force-pushed the feat/advanced_query_search_syntax_for_multi_byte_search branch from 5c261f6 to b82c389 Compare September 27, 2025 16:41
@yoshiokatsuneo yoshiokatsuneo marked this pull request as ready for review September 27, 2025 16:48
@eradman
Copy link
Collaborator

eradman commented Oct 6, 2025

Very nice. Do we also need to make a corresponding change to documentation?

@yoshiokatsuneo yoshiokatsuneo force-pushed the feat/advanced_query_search_syntax_for_multi_byte_search branch from ba57e9c to e0cee56 Compare October 8, 2025 14:39
@yoshiokatsuneo
Copy link
Contributor Author

Very nice. Do we also need to make a corresponding change to documentation?

@eradman

Thank you for the comment !
I just tried to added a tooltip as a help. How about ?

43148ba

image

@eradman
Copy link
Collaborator

eradman commented Oct 10, 2025

I think this is too much information for a tooltip.

For detailed information the information that open for "Number format" (under Edit Visualization) works nicely but that seems like overkill for this feature.

@yoshiokatsuneo
Copy link
Contributor Author

@eradman

Thank you for your feedback !
Do you have any suggestion where to put the information ?

It may be a bit tricky as this feature is valid only when multi byte search is enabled.

@eradman
Copy link
Collaborator

eradman commented Oct 14, 2025

Do you have any suggestion where to put the information ?
It may be a bit tricky as this feature is valid only when multi byte search is enabled.

I don't have a better idea for this. We could add it as a hidden/undocumented feature, but that's not a good habit.

@yoshiokatsuneo
Copy link
Contributor Author

@eradman

May we add the document on the user guide and open it as a side-bar, as Formatting Guide on the alert page ?

image

@eradman
Copy link
Collaborator

eradman commented Oct 15, 2025

May we add the document on the user guide and open it as a side-bar

I think this is the right way to go. To start we can add this hidden feature (no tooltip), just a source code comment, and update documentation later.

@yoshiokatsuneo
Copy link
Contributor Author

@eradman

Thank you! So, at first, I just removed the tooltip for now.

# - name:"multiple words"
# - word1 word2 word3
# - word1 "multiple word" query:"select foo"
tokens = re.findall(r'(?:([^:\s]+):)?(?:"([^"]+)"|(\S+))', term)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is there a better way to break words and "multiple words" into tokens? This regex appears to work, may also contain hard-to-find edge cases

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@eradman

Thank you for the review!

At first, the query string matches one of those.

  • Qualifier:Keyword => (?:([^:\s]+):) AND (?:"([^"]+)"|(\S+))
  • Keyword => (?:"([^"]+)"|(\S+))

And, the keyword matches one of those:

  • "any characters" => "([^"]+)"
  • NonSpaceCharacters => (\S+)

I think this covers the all 4 cases( 2 cases x 2 cases).

Or, we may implement simple tokenizer. That makes more flexible, but it need a bit of code.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Or, we may implement simple tokenizer. That makes more flexible, but it need a bit of code.

The regex is very compact. We can refactor this in the future if we need more flexibility

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@eradman

I see. Thank you !

@yoshiokatsuneo yoshiokatsuneo enabled auto-merge (squash) October 15, 2025 15:42
@yoshiokatsuneo yoshiokatsuneo merged commit bac2160 into getredash:master Oct 15, 2025
11 checks passed
@yoshiokatsuneo
Copy link
Contributor Author

And, I tried to create a PR for the documentation.
getredash/website#844

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.

2 participants