Skip to content

Conversation

foogaro
Copy link
Contributor

@foogaro foogaro commented Aug 11, 2025

Changes

feat(query): add NUMERIC_IN query clause for Redis repository 'In' methods
fix(indexing): enable @NumericIndexed type for @Id fields without schema duplication error

Query

Introduced support for the NUMERIC_IN query clause to handle Spring Data style repository methods ending with 'In'.
This enables querying Redis repositories using a collection of numeric values, improving parity with Spring Data JPA query method conventions and enhancing developer ergonomics.

Example:

  findByIdIn(List<Integer> ids)

Indexing

Previously, configuring an @Id field with the @NumericIndexed index type was technically possible but caused index creation to fail with:

2025-08-11T16:42:09.406+02:00 WARN c.r.o.s.indexing.RediSearchIndexer - [main] - createIndexFor - Skipping index creation for com.foogaro.modeling.model.DocumentsIdx because Duplicate field in schema - id

This happened because the Id field was already implicitly added to the index schema, and explicitly declaring it as @NumericIndexed created a duplicate entry.
Now, the check also considers @NumericIndexed in the “already indexed” list, so it won’t add it twice.

@foogaro foogaro requested a review from bsbodden August 11, 2025 21:32
Copy link
Collaborator

@bsbodden bsbodden left a comment

Choose a reason for hiding this comment

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

LGTM, will follow up with an extra commit

@bsbodden bsbodden merged commit 790fea1 into redis:main Aug 19, 2025
1 check passed
bsbodden added a commit to bsbodden/redis-om-spring that referenced this pull request Aug 19, 2025
…ration

- Fix NUMERIC_IN to not escape numeric values (dots in decimals were being escaped)
- Add missing NUMERIC_NOT_IN implementation using RediSearch negation pattern
- Add support for arrays/varargs parameters in collection queries
- Handle empty collections correctly (NUMERIC_IN returns no results, NOT_IN returns all)
- Fix query combination for multiple values using proper OR syntax with parentheses

test: add comprehensive tests for numeric IN/NOT_IN queries

- Add NumericInQueryTest with 17 test cases covering all numeric types
- Add NumericIndexedIdFieldTest to verify @NumericIndexed on @id fields
- Add NumericInQueryClauseTest for enum verification
- Add metamodel generator test for @NumericIndexed ID fields
- Test edge cases: empty collections, single values, large numbers, nullables

Fixes issues found in PR redis#645 where NUMERIC_IN had syntax errors and
NUMERIC_NOT_IN was not implemented. All tests now pass.
bsbodden added a commit to bsbodden/redis-om-spring that referenced this pull request Aug 19, 2025
…ration

- Fix NUMERIC_IN to not escape numeric values (dots in decimals were being escaped)
- Add missing NUMERIC_NOT_IN implementation using RediSearch negation pattern
- Add support for arrays/varargs parameters in collection queries
- Handle empty collections correctly (NUMERIC_IN returns no results, NOT_IN returns all)
- Fix query combination for multiple values using proper OR syntax with parentheses

test: add comprehensive tests for numeric IN/NOT_IN queries

- Add NumericInQueryTest with 17 test cases covering all numeric types
- Add NumericIndexedIdFieldTest to verify @NumericIndexed on @id fields
- Add NumericInQueryClauseTest for enum verification
- Add metamodel generator test for @NumericIndexed ID fields
- Test edge cases: empty collections, single values, large numbers, nullables

Fixes issues found in PR redis#645 where NUMERIC_IN had syntax errors and
NUMERIC_NOT_IN was not implemented. All tests now pass.
bsbodden added a commit that referenced this pull request Aug 19, 2025
…ration

- Fix NUMERIC_IN to not escape numeric values (dots in decimals were being escaped)
- Add missing NUMERIC_NOT_IN implementation using RediSearch negation pattern
- Add support for arrays/varargs parameters in collection queries
- Handle empty collections correctly (NUMERIC_IN returns no results, NOT_IN returns all)
- Fix query combination for multiple values using proper OR syntax with parentheses

test: add comprehensive tests for numeric IN/NOT_IN queries

- Add NumericInQueryTest with 17 test cases covering all numeric types
- Add NumericIndexedIdFieldTest to verify @NumericIndexed on @id fields
- Add NumericInQueryClauseTest for enum verification
- Add metamodel generator test for @NumericIndexed ID fields
- Test edge cases: empty collections, single values, large numbers, nullables

Fixes issues found in PR #645 where NUMERIC_IN had syntax errors and
NUMERIC_NOT_IN was not implemented. All tests now pass.
bsbodden added a commit that referenced this pull request Aug 19, 2025
…ration

- Fix NUMERIC_IN to not escape numeric values (dots in decimals were being escaped)
- Add missing NUMERIC_NOT_IN implementation using RediSearch negation pattern
- Add support for arrays/varargs parameters in collection queries
- Handle empty collections correctly (NUMERIC_IN returns no results, NOT_IN returns all)
- Fix query combination for multiple values using proper OR syntax with parentheses

test: add comprehensive tests for numeric IN/NOT_IN queries

- Add NumericInQueryTest with 17 test cases covering all numeric types
- Add NumericIndexedIdFieldTest to verify @NumericIndexed on @id fields
- Add NumericInQueryClauseTest for enum verification
- Add metamodel generator test for @NumericIndexed ID fields
- Test edge cases: empty collections, single values, large numbers, nullables

Fixes issues found in PR #645 where NUMERIC_IN had syntax errors and
NUMERIC_NOT_IN was not implemented. All tests now pass.
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