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

Add checking the array has a specific number on NumericField class #400

Open
chiyongs opened this issue Mar 24, 2024 · 1 comment
Open
Assignees
Labels
enhancement New feature or request

Comments

@chiyongs
Copy link

Hi there,

https://redis.io/docs/interact/search-and-query/indexing/#index-json-arrays-as-numeric
According to the guide page, I can index the JSON array to NUMERIC.
With this feature, I can also check if the number in the array is in a specific range and if the array has a specific value.
However, the com.redis.om.spring.metamodel.index.NumericField class does not provide a way to verify that an array contains a specific number.
Since the above features are not supported, I need to put a string other than a number into an array to see if it is included using a TAG index, or use a native query using the RedisDocumentRepository.
However, I would like to implement these features using EntityStream and NumericField.

For instance, implement it like the code below or there seems to be a way to change it like TagField's in method.

public InPredicate<E, ?> containsLong(Long... values) {
    return new InPredicate<>(searchFieldAccessor, Arrays.asList(values));
}

I would like to ask for your opinion on this.

@bsbodden bsbodden self-assigned this Mar 24, 2024
@bsbodden bsbodden added the enhancement New feature or request label Mar 24, 2024
@bsbodden
Copy link
Contributor

@chiyongs can you help me a concrete example using EntityStreams of what you think this might look like, that way I can start tinkering with the cleanest way to accomplish it. Cheers!

@bsbodden bsbodden assigned maorohana-redis and unassigned bsbodden May 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants