I have to search using a collection of words in a database. The sequence of the words doesn't matter. For example: `"How to build a computer" is a string in the database. I should be able to get this result by just putting in the string "build computer".
Currently, I am using a sqlite3 database with Django. I tried solving the problem by splitting the words in the query and then looping through the database to check if the word was in the records of the database. The more words of the query are in the record, the higher the ranking of that particular record in the database.
But my approach involves splitting each record in the database, and then search all of the records using every word in my search query. Is there any way to optimise my algorithm?