How to create Server Script API for search field?

I am using frappe as a backend of an Android app which is retrieving data using Rest Api I have Search bar in Page of Courses and I have a DocType of Courses as well. I want to know if there is any way to counter this problem that if user enter (Ben Mac) he/she will able of see a course which have field (title) and a course title is (Benefits of Mac).

api/resource/Courses?filters=["title","like","Ben Mac%"]

filter like this is not working for me. In this case it shows nothing but when I type (Benefits) it show me the result.

There is an API to search for documents directly: frappe.desk.search.search_link

The API performs the search on all the “search fields” mentioned in the DocType.

It’s a GET request with the following params:

  1. doctype
  2. txt (this is your search query)
  3. page_length (number of results you want),
  4. filters (any additional filters you want to apply)

To call this API, you would need to query the /api/method/frappe.desk.search.search_link endpoint.