perplexhub / rsql-jpa-specification

Java Library to Translate RSQL into Spring Data JPA Specification and QueryDSL Predicate
MIT License
230 stars 63 forks source link

Does rsql-jpa-specification have any special way to support case insensitive like queries? #8

Closed phamdong2812 closed 5 years ago

phamdong2812 commented 5 years ago

Does rsql-jpa-specification have any special way to support case insensitive like queries? like 'a^' or like 'a*'?

Thanks

perplexhub commented 5 years ago

filter = "company.code==^EM"; //ignore case equal ilter = "company.code==dem"; //like dem% filter = "company.code==emo"; //like %emo filter = "company.code==em"; //like %em% filter = "company.code==^EM"; //ignore case like %EM% filter = "company.code=='^EM'"; //ignore case like %EM%

phamdong2812 commented 5 years ago

Thanks for the reply!. But: Input some special characters such as (^ , ). rsql-jpa search records which don't contain inputed special characters. Expected Result: only find record containing special character (^ , ).

builder.like(builder.upper(attrPath), argument.toString().replace("*", "%").replace("^", "").toUpperCase());

perplexhub commented 5 years ago

You can try below workaround. filter = "company.code=in=()"; //equal to filter = "company.code=in=(^)"; //equal to ^

phamdong2812 commented 5 years ago

Thanks! I used as you in the case of equal comparison. But the case of like (^ ,* ), really have not found a solution.

perplexhub commented 5 years ago

Let me add some new operators to support your cases

phamdong2812 commented 5 years ago

Thanks

perplexhub commented 5 years ago

e.g. =like= =ilike= =icase=

Stay tuned

phamdong2812 commented 5 years ago

Thanks! When is the update for this case?

perplexhub commented 5 years ago

Please use version 4.0.8

phamdong2812 commented 5 years ago

Thanks. if (op.equals(IGNORE_CASE_LIKE)) { return builder.equal(builder.upper(attrPath), "%" + argument.toString().toUpperCase() + "%"); }

builder.equal ==> builder.like ??

perplexhub commented 5 years ago

version 4.0.9, thanks!

phamdong2812 commented 5 years ago

Upgrade version 2.01==>4.09 exception [io/github/perplexhub/rsql/RSQLConfig.class]: Post-processing of merged bean definition failed; nested exception is java.lang.IllegalStateException: Failed to introspect Class [io.github.perplexhub.rsql.RSQLSupport] from ClassLoader [sun.misc.Launcher$AppClassLoader@18b4aac2]. java.lang.NoClassDefFoundError: com/querydsl/core/types/Path

Must add plugin ==> Is there any other solution?

com.mysema.maven apt-maven-plugin 1.1.3 process target/generated-sources/java com.querydsl.apt.jpa.JPAAnnotationProcessor
perplexhub commented 5 years ago

you need to add your own querydsl dependency in your pom if you use querydsl

    <dependency>
        <groupId>com.querydsl</groupId>
        <artifactId>querydsl-core</artifactId>
        <version>${querydsl-core.version}</version>
    </dependency>
perplexhub commented 5 years ago

take a look https://github.com/perplexhub/rsql-jpa-specification/blob/master/pom.xml