Search Field in Search Application

Is it possible to get access to the search field (The value that I am typing in)? I would like to sort the results in a search application like this:

ORDER BY INSTR(field1,searchfield), field1

searchfield is what I am actually typing in the search field not the field that I am searching in. I am using the data type Text Auto-Complete so that I can enter my own SQL statement.

can you give an example of the ORDER BY in combination with INSTR?

I would like the results to be “Best Match”.

So basically, I want to order the results so that the ones where the string is found at the beginning of the field come first and those where the string appears later in the field come last.

An example: searching for ‘hab’ currently returns

a lphabet
h abit
r ehab

but I’d like it this way:

hab it (first because ‘hab’ is the beginning)
alp hab et (second because ‘hab’ is in the middle of the field)
re hab (last because ‘hab’ is at the end of the field)

I want the results to show up as the user is typing in the search field. Something similar to this site https://www.myfooddiary.com/

Have you been able to extract to script when typing the food field on this siete https://www.myfooddiary.com/?

No, I’m afraid that is over my head.