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

allow searching for multiple meta terms #913

Merged
merged 2 commits into from Aug 31, 2023
Merged

Conversation

TylerNoblett
Copy link
Collaborator

@TylerNoblett TylerNoblett commented Aug 31, 2023

fixes bug where searching for multiple meta terms returned an error

If you searched for two meta terms, the sql that this function generated looks like this:

WHERE  evidence.operation_id = ?
       AND evidence.id IN (SELECT evidence_id
                           FROM   evidence_metadata
                           WHERE  body LIKE ?
                                  AND body LIKE ?)

which includes three parameter placeholders. However, sqlx was complaining because the last two params were passed along as a slice (ie [4, ["%13%", "%seed_juice%"]]) so it counted only two values, which didn't line up with three placeholders. Destructuring the body Like params solves the problem [4, "%13%", "%seed_juice%"] because now there are an equal number of params and placeholders.

I confirm that this contribution is made under the terms of the license found in the root directory of this repository's source tree and that I have the authority necessary to make this contribution on behalf of its copyright owner.

@TylerNoblett TylerNoblett linked an issue Aug 31, 2023 that may be closed by this pull request
@jkennedyvz jkennedyvz merged commit 850274b into main Aug 31, 2023
9 checks passed
@TylerNoblett TylerNoblett deleted the tn/fix-meta-search-bug branch August 31, 2023 18:21
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.

Metadata search breaks when using multiple terms
3 participants