02-10-2011

Creating search suggestion for our custom search

After having finished the search engine project the next step was starting logging the user inputs, the keywords. I found that a lot of users wrote keywords that delivered 0 results. These keywords often had spelling mistakes so I decided to create an alternative for the user. Of course when a query returned 0 results I already gave them some content we knew they would like but I decided to give them extra keywords options to follow.

In order to make the system performance friendly, the ideal was generating all these suggestion keywords daily or even weekly using a cron. This way our database would have all the data saved already and the users would have them ready every time they type input without generating them on the fly.

The problems

Our keyword log dabatase had so much data, so much rows. The algorithm involved for generating search suggestion took too much time so the first step was filtering the data and creating only suggerences for the top 10% keywords. I made a few changes to the logger so we had a counter insights for each keyword. This way the time involved in the generation improved 90%.

With the data already filtered, I used the popular distance algorithm levenshtein. For each keyword that delivered 0 content results, I made sure to generate some keywords suggerences. So the user had something to follow up related to his query. This is not something new, but you rarely see it implemented in custom search websites. This feature improved user interaction in google analytics.

Finally, the last step was saving all the data in the proper way in order have it loading within PHP. This was the final result for keywords like poquemon and cosinar con sara which are delivered 0 results.

Search suggestion example from macrojuegos.com Search suggestion

Another earch suggestion

Some code about it. Objects and methods involved for this feature Code example

Disclaimer: This project is confidential. As a result, I am unable to provide access to the complete source code, but I can share images or small code snippets for demonstration purposes, with the owner's permission. However, if needed for an interview, I may be able to grant access to the private repository where this code or a copy of it is stored.
  • php
  • mysql
  • search-engine
  • web-development
  • private-project
  • company:panaworld

Contact Me

Do you have any questions? I'm from Barcelona. Below you'll find different contact options.

Status: I'm currently working 100% remotely as a Full Stack Developer, but I'm also open to opportunities that will help me grow my career.

contacto@danieldev.es

This PWA has been created by Daniel Domínguez Rubio using technologies such as: React, Gatsbyjs, GraphQL, Nodejs, AWS S3, and Cloudfront.

v1.11.0