Autocomplete with static files [1/4] - Introduction

An introduction to static files and the benefits of generating static files for your autocomplete implementation.

Mon Nov 20 2017

Why would anybody even want to use static files? When they have access to a perfectly fine queryable database, it seems totally crazy.

Or does it?

Below are some pros and cons of using static files for autocomplete searches:


  • No server-side logic == much much faster!
  • Reliability, fewer points of failure, no database issues
  • Cheaper and more options for hosting


  • More space used on the server, one file for each letter sequence that results. For example: A -> { Andrew, Adam, Anthony }, AN -> { Andrew } etc…
  • Data is not real time. Generating the static files must be done upfront during build time.
  • Generating the static files can be a burden
  • Basic autocomplete only, no match for ElasticSearch or SOLR

In this series I will walk through the following topics, step by step:

  1. Learning from a visualization of the trie data structure
  2. Typing our own words into the visualization
  3. Downloading sample CSV’s
  4. Building an autocomplete static file generator
  5. Understanding a trie data structure for storing words in relation
  6. Covering recursive trie traversal algorithms
  7. Using the generator with a CSV
  8. Building a basic autocomplete implementation utilizing static files
  9. Using the demo
Paul Ness

Paul S. Ness Software engineer with ten years of experience in a variety of industries such travel, payments, medical, fine art and publishing.