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:
Pros
- No server-side logic == much much faster!
- Reliability, fewer points of failure, no database issues
- Cheaper and more options for hosting
Cons
- 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:
- Learning from a visualization of the trie data structure
- Typing our own words into the visualization
- Downloading sample CSV’s
- Building an autocomplete static file generator
- Understanding a trie data structure for storing words in relation
- Covering recursive trie traversal algorithms
- Using the generator with a CSV
- Building a basic autocomplete implementation utilizing static files
- Using the demo