I am trying to make exact search but getting problem when search with “Sonal”, I am getting result from the record has “Sonal” & “personal”. When I remove % before var name then getting the result which record start from “Sonal” and doesn’t find that text has “Sonal” anywhere.
Here is the query:
AND (
lower(document_text) LIKE '%".$search_name2."%'
OR lower(customdoc_name) LIKE '%".$search_name2."%'
OR lower(doc_tags) LIKE '%".$search_name2."%'
)
Rec. 1 – Personal Certificate
Rec. 2 – Sonal Certificate.
I want only 2nd record return when search with “Sonal”.
I am not using FULLTEXT Field.
this may help,
add space back of string or front and back or front only. by this you will get result with “sonal” in case of beginning of string or middle of string or end of string.