on 04-19-2016 8:55 AM
Hi,
I have requirement to have a fuzzy search over a columnar table. But the requirement demands fuzzy search with wildcard character. But when i call fuzzy search with contains using % or * as wild card character, it will do an exact match with wildcard character. Even in Sap documentation its written,
Asterisk (*) : The asterisk activates a wildcard search. In this case, no fuzzy search is performed. An exact match with wildcards is called instead.
Percent Sign (%) : The percentage sign is replaced with an asterisk (*), and a wildcard search is called.
If my table TABLE1 has records,
X Y
--------------
1 AKSHAY NAYAK
2 AKSHAY
3 AKSHAY NAYAK K
if i run below statement,
Query1:
Select * from
TABLE1
WHERE CONTAINS(Y,'%AKSHEY%',FUZZY(0.9))
Query2:
Select * from
TABLE1
WHERE CONTAINS(Y,'AKSHEY',FUZZY(0.9))
Query1 i don't get any output as an exact search will be called with wilcard character. but Query 2 i get AKSHAY as output as fuzzy will pull based on fuzzy score (>=0.9). But my requirement needs all 3 rows as output with fuzzy and wildcard search together.
Thanks in advance
Regards,
Akshay
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Muthuram,
i tried creating a table with TEXT datatype and i tried the above solution, it worked. But this works for situation where your search token is separated by space. if i try to search AKSH it wont match,
I should have got all 3 rows as output since AKSH should match with all of them.
Thanks,
Akshay
Hi Akshay,
Why dont you use low fuzzy score??
Execute the below query
Select * from TABLE1 where contains (Y,'AKSHEY',FUZZY(0.1))
Thsi will give you all the values
Regards
Priyanka
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
As you have found out from the manual, you can't have a fuzzy search and a wildcard search at the same time.
As a workaround you might want to try other parts from the manual.
Option similarCalculationMode=substringsearch perhaps?
hope this helps
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Josef,
I tried above approach but the SCORE calculation is very less that even a single change in character would result in difference of 0.4 to 0.5. so basically if there is a change in search string by 2 characters, it never shows in output.
this is the impact ,
Mode wrong characters additional characters in search additional characters in table
substringsearch high high low
Thanks,
Akshay
User | Count |
---|---|
90 | |
10 | |
10 | |
10 | |
7 | |
7 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.