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

Like and notLike not works #532

Open
guos opened this issue Jan 1, 2025 · 2 comments
Open

Like and notLike not works #532

guos opened this issue Jan 1, 2025 · 2 comments
Assignees
Labels
enhancement New feature or request

Comments

@guos
Copy link

guos commented Jan 1, 2025

the existing like can only support fulltext, not support % like SQL

eg:

List comList = entityStream.of(Blocks.class).filter(Blocks$.BLOCKED.eq(true))
.filter(Blocks$.USER_ID.eq("100007")).filter(Blocks$.NICK_NAME.like("GoodAbc%"))
.collect(Collectors.toList());
if DB nick_name ="GoodAbc100007"

above will not find out

if input full nick_name like

List comList = entityStream.of(Blocks.class).filter(Blocks$.BLOCKED.eq(true))
.filter(Blocks$.USER_ID.eq("100007")).filter(Blocks$.NICK_NAME.like("GoodAbc100007"))
.collect(Collectors.toList());

then it have result correctly

so question is, any way to support like Blocks$.NICK_NAME.like("GoodAbc%") or Blocks$.NICK_NAME.like("GoodAbc*") ?

redis om spring version :0.9.7
spring boot version:3.4.0
jdk: openjdk 17.0.6
jedis:5.2.0

@guos
Copy link
Author

guos commented Jan 1, 2025

use containing works

List comList = entityStream.of(Blocks.class)
.filter(Blocks$.BLOCKED.eq(true))
.filter(Blocks$.USER_ID.eq("100007"))
.filter(Blocks$.NICK_NAME.containing("GoodAbc"))
.collect(Collectors.toList());

@bsbodden bsbodden self-assigned this Jan 18, 2025
@bsbodden
Copy link
Contributor

The like predicated works by adding "%%%" + query + "%%%" effectively turning into a Fuzzy search https://redis.io/docs/latest/develop/interact/search-and-query/query/full-text/
The number of % signifies the "word distance", as in find all documents that contain a word that has a distance of three to a ( potentially misspelled) word.
In the future I might add a predicate that is just a taken literally and place in the query. Stay tuned...

@bsbodden bsbodden added the enhancement New feature or request label Feb 16, 2025
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

2 participants