Releases: OleksandrChernokolov/database-search-PHP-SQL
Releases · OleksandrChernokolov/database-search-PHP-SQL
Database search algorithm (PHP/SQL). Initial release.
General information
Smart and fast search algorithm based on PHP. In this case, a database of world cities search using SQL queries is presented. There are some features of the algorithm:
- Retrieve the 10 most relevant results or similar results if there are no exact matches.
- The result will be found even if a small error is made in the request or the request is inaccurate.
- The presence of an array of exception words or service words that will be found last if there are no other results.
- High search speed. In the country of the hosting provider, the average request speed is 60 - 100 milliseconds. (In this case, there are 43 thousand cities in the database)
The code also comes with a function to create keywords from a string, which is target for search. Having keywords column in DB table makes search more efficient, because:
- Saves time for processing the target string during the search.
- Creates the possibility of adding new keywords by which the target string can be found without changing it.
- Creates the possibility of excluding exception words (or service words).
Search interface implemented using JavaScript, HTML, CSS. This demo is made in a minimalistic but functional design with a convenient mobile version.
The code also provides a JavaScript function for switching between the found results using the cursor.