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

Fix q filter fails to search multiple words #81

Merged
merged 1 commit into from
Jul 23, 2024
Merged

Fix q filter fails to search multiple words #81

merged 1 commit into from
Jul 23, 2024

Conversation

fzaninotto
Copy link
Member

Problem

FakeRest’s q filter looks for the passed string in all fields of the resource. This is fine when looking for a company name (e.g. “Acme”), but not when looking for a full name (e.g. “John Doe”) as none of the fields of the resource match the string if the name is split across first_name and last_name. As a result, a search on "John Doe" returns nothing.

Solution

Update the q search to split the input string by white space, search for each word, and combine the results (OR logic)

@adguernier adguernier self-requested a review July 23, 2024 09:29
@djhi djhi added this to the 4.1.0 milestone Jul 23, 2024
@djhi djhi merged commit 394cf1b into master Jul 23, 2024
5 checks passed
@djhi djhi deleted the smarter-q branch July 23, 2024 09:38
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.

3 participants