redis / redis-om-spring

Spring Data Redis extensions for better search, documents models, and more
MIT License
609 stars 94 forks source link

Support TextTagField and TextField GraterThan, LessThan or CompareTo #526

Open guos opened 5 days ago

guos commented 5 days ago

@bsbodden Sorry to trouble you , any way to achive field> string

-------------------------obj as @Document Comments{ @Id String comId; ......................... }

-------------------------want something like sql where com_id>'xxx' for string field

entityStream.of(Comments.class).filter(e-> (Comments$.COM_ID.gt("100000003"))).collect(Collectors.toList());

checked ,

ExampleMatcher,TextTagField ,TextField

also try something in RedisDocumentRepository

List findByComIdGreaterThan(String comId);

but they are not working

guos commented 3 days ago

I use follow way :

public List<Comments> queryComments(String commentsId) {

    Predicate<String> predicate = i -> (i.compareTo(commentsId) > 0);

    List<String> commentsIds = entityStream.of(Comments.class).map(Comments$.COMMENT_ID).filter(predicate)
            .collect(Collectors.toList());

     return commentRepo.findAllById(commentsIds);

}