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

Filters Search Failing With Underscore (_) #1038

Open
drveresh opened this issue Jul 15, 2024 · 2 comments
Open

Filters Search Failing With Underscore (_) #1038

drveresh opened this issue Jul 15, 2024 · 2 comments
Assignees
Labels

Comments

@drveresh
Copy link

The search filter with an underscore (_) in the field name is failing, is this normal, or does it require any formatting?

Example endpoint: "/records/logs?page=1,20&order=id,desc&filter=msg,cs,account_id"

There, I am searching in the log records, where the field msg contains a string like "Service account_id 1234 is updated". So, I want to search all log records that contain the string "account_id".

I am not sure, but this could be a bug or something else.

Please help me out with its solution.

@mevdschee mevdschee self-assigned this Jul 15, 2024
@mevdschee mevdschee added the bug label Jul 15, 2024
@mevdschee
Copy link
Owner

mevdschee commented Jul 15, 2024

The search filter with an underscore (_) in the field name is failing, is this normal, or does it require any formatting?

Hi Veeresh, Maybe because "CS" does a SQL "LIKE" and underscore is a wildcard in SQLite? I'll try to reproduce the bug. Kind regards, Maurits

@daddyfix
Copy link

daddyfix commented Aug 21, 2024

I had the same problem with underscores and 'cs' and 'sw' filters
/records/scripts?filter=filename,cs,nfs_tools/&include=id,filename
and
/records/scripts?filter=filename,sw,nfs_tools/&include=id,filename
would not work

I had to modify my query with 'eq'. but luckily the search field is exact.
/records/scripts?filter=filename,eq,nfs_tools/&include=id,filename
-> {"records":[{"id":10,"filename":"nfs_tools/"}]}

I think its the sqlite3 'LIKE'

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

No branches or pull requests

3 participants