This page--although I don't know java programming-raises and tackles the issue of how long it takes to sort a list of items into some order. This might be relevant to the query about the indexing behind search engines given that classically an index is in alphabetical order -- so it has to be put in that order then later searched.
I don't understand the jargon, let alone how Sphinx works, but this page shows that there is a realm in which people address how to make a searching process efficient. Let's see if I can backup and find out what they studied or mastered to get to this conversation. (Perhaps a step offline to talk to a computer scientist would be helpful at this point.)