Skip to content

feat: allowing in filtering to accept a collection as a parameter#711

Merged
bsbodden merged 2 commits intoredis:mainfrom
raphaeldelio:feature/in-filter-with-collections
Feb 6, 2026
Merged

feat: allowing in filtering to accept a collection as a parameter#711
bsbodden merged 2 commits intoredis:mainfrom
raphaeldelio:feature/in-filter-with-collections

Conversation

@raphaeldelio
Copy link
Contributor

This PR adds a new in(Collection values) method to the TagField class, allowing users to pass Collections (List, Set, etc.) directly to the in() predicate without needing to convert them to arrays first.

Motivation
Previously, users who had their filter values in a List or other Collection had to manually convert them to arrays using .toArray(new String[0]) before passing them to the in() method:

This was inconvenient and not intuitive, especially since Collections are a common way to store and pass around groups of values in Java.

@raphaeldelio raphaeldelio requested a review from bsbodden February 6, 2026 13:57
@jit-ci
Copy link

jit-ci bot commented Feb 6, 2026

Hi, I’m Jit, a friendly security platform designed to help developers build secure applications from day zero with an MVS (Minimal viable security) mindset.

In case there are security findings, they will be communicated to you as a comment inside the PR.

Hope you’ll enjoy using Jit.

Questions? Comments? Want to learn more? Get in touch with us.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR enhances the TagField class by adding a new in(Collection<String>) method that allows users to pass Collections (List, Set, etc.) directly to the in() predicate without needing to convert them to arrays first. This improves the developer experience by removing the need for manual .toArray(new String[0]) conversions.

Changes:

  • Added in(Collection<String>) method to TagField class with proper documentation
  • Updated test data setup to use varied role assignments across users (improving test quality)
  • Added comprehensive test coverage for the new Collection-based in() method
  • Fixed an existing test assertion that was passing incorrectly due to homogeneous test data

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
redis-om-spring/src/main/java/com/redis/om/spring/metamodel/indexed/TagField.java Adds new in(Collection<String>) method overload using List.copyOf() to convert the collection to an immutable list
tests/src/test/java/com/redis/om/spring/search/stream/EntityStreamDocsTest.java Updates User test data to use varied roles per user, adds three new tests for the Collection-based in() method, and fixes testArrayLenToSimpleIndexedTagFieldInDocuments assertion to match the corrected test data

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@bsbodden bsbodden merged commit 1716229 into redis:main Feb 6, 2026
2 checks passed
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