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));
}
@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!
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, thecom.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 aTAG
index, or use a native query using theRedisDocumentRepository
. However, I would like to implement these features usingEntityStream
andNumericField
.For instance, implement it like the code below or there seems to be a way to change it like TagField's
in
method.I would like to ask for your opinion on this.