Skip to content

Add deep search for filter taking in properties#1749

Closed
andershagbard wants to merge 10 commits intoShopify:mainfrom
andershagbard:deep
Closed

Add deep search for filter taking in properties#1749
andershagbard wants to merge 10 commits intoShopify:mainfrom
andershagbard:deep

Conversation

@andershagbard
Copy link
Contributor

@andershagbard andershagbard commented Oct 16, 2023

This PR allows for backward compatibility deep search :woah:

Like so:

{{ input | where: 'some.nested.property', 'foo', deep: true }}
{{ input | where: 'some_nested_property', 'foo', deep: '_' }} # Custom separator

Added deep search for the following filters. This should be all Liquid filters which takes in a property argument:

  • map
  • sort
  • sort_natural
  • sum
  • uniq
  • where
  • compact

@andershagbard
Copy link
Contributor Author

@dylanahsmith I am not sure if you still work on Liquid, but I would love for someone in the Liquid team to take a look at this PR.

@andershagbard
Copy link
Contributor Author

@karreiro @benjaminsehl ping

Copy link
Contributor

@karreiro karreiro left a comment

Choose a reason for hiding this comment

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

👋 Hey @andershagbard,

Thank you for this PR. Could you please share your reasoning behind the deep parameter?

I feel like it was introduced with backward compatibility concerns; however, I believe it may bring a bit of complexity to the language and to language server implementations. I don't think it's required for backward compatibility, but I'm not sure if I'm missing something in that aspect.

Thanks again for this PR!

@andershagbard
Copy link
Contributor Author

It's to safeguard against the JSON field type, which can contain dots in it's properties. It's an edge case I guess.

{
  "foo.bar": true
}

Ref: #1436 (comment)

karreiro added a commit that referenced this pull request Jan 14, 2025
* Add reject filter #1573

* Add deep search for filter taking in properties #1749

* Update branch with main

* Add `find`, `find_index`, `has`, and `reject` filters to arrays

* Refactor: avoid usage of public_send

---------

Co-authored-by: Anders Søgaard <andershagbard@gmail.com>
Co-authored-by: Anders Søgaard <9662430+andershagbard@users.noreply.github.com>
andrykonchin pushed a commit to andrykonchin/liquid that referenced this pull request Feb 24, 2025
…ify#1869)

* Add reject filter Shopify#1573

* Add deep search for filter taking in properties Shopify#1749

* Update branch with main

* Add `find`, `find_index`, `has`, and `reject` filters to arrays

* Refactor: avoid usage of public_send

---------

Co-authored-by: Anders Søgaard <andershagbard@gmail.com>
Co-authored-by: Anders Søgaard <9662430+andershagbard@users.noreply.github.com>
@andershagbard
Copy link
Contributor Author

Closed by #1869

@andershagbard andershagbard deleted the deep branch July 7, 2025 06:43
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