I have a column c1 (varchar(400))
in table t1
in MYSql database. This column can contain data in plain text and json format like "abcd","12345.6",{"key1":"value1"},{"key1":"value1","key2","value2"}
etc. I want to implement a fuzzy search
logic in this column. User can search using "34", "cd",{"key1":"value1"}, "value1"
etc. User can perform serch by providing a full or partial value. User can provide the entire json value or partial value.
I am currently doing a search on multiple columns using the JpaSpecificationExecutor
so in this perticular column search i have added criteriaBuilder.like("c1","%" + value + "%")
. Performance is really slow by using like operator. Problem here is user can pass the values in text and json format both and it is doing a full table scan as i am using "%value%"
.
Can you suggest some approach i can use to implement a fuzzy search in spring data jpa? Any suggestion is welcome which migh have worked for you in past experiences. i will try those.
I am using spring-data-jpa 2.3.3 version
and mysql 5.7.22
version.