Skip to content

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

Open
@chiyongs

Description

@chiyongs

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.

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions