vteam #579 was hired to work on the project of a web based search engine application. In this application, the pre-stored database of businesses was categorized on the basis of the ‘business type’. The application users were facilitated to search for any business type stored in the database.
The problem arose when the users tried to look-up for a business by typing generic or random terms in the search bar. The search results would not contain the intended business type but, in fact, may come up with the results from other categories due to a typing error. For instance, if a category is named as ‘Car Wash’ but the user mistakenly types “Car Washes”. In this case, the search result will not come up with any ‘business’ because there exists no category in the database with such name.
Users may have an option to use the search feature like an operator or by running a query for randomly typed strings but this would prove to be a temporary solution. Reason being that the main issue still exists i.e. if a category is named as ‘car’ but the user typed “cars”.
Soundex Implementation
vteams engineer Jaffar Hussain proposed an alternative solution i.e. to use ‘Soundex’ which could be very effective for the current scenario. For example, if a user search either ‘car’ or ‘cars’ after soundex implementation, it would not make much difference as the search results will then contain all the ‘businesses’ in ‘car’ and ‘cars’ category.
The functionality of Soundex is on the principle of ‘Hashing’ as the results will contain the same hash for ‘car’ and ‘cars’. Hence, a user can search through Soundex without facing the issue of term or spelling inconsistency.
In order to achieve more precise search results, Jaffar invested his abilities in implementing Soundex which enables the users to search for terms that may have more or less the same sound but are spelled differently (like that in the example of ‘car’ and ‘cars’ discussed earlier). The issue was fixed using helper APIs through which a new column was created in the categories. After that, the Soundex values were assigned to these categories. At the end, the search algorithm was altered to fetch search results based on similar Soundex values which in turn resulted in a more intelligent, productive and precise search tool.