Documentation
¶
Overview ¶
search.go implements a super simple location search by name.
The main elements are:
- Load TERC and SIMC data.
- Use data to create a tree like structure. root ─┬─ PODKARPACKIE ─┬─ Przemyśl │ └─ Rzeszów └ WARMIŃSKO-MAZURSKIE ─┬─ Elbląg ├─ Ełk └─ Olsztyn
3. From the tree like structure it creates a list of all nodes. 4. It starts a search loop.
Search is simple process:
- Read text from stdin, strip from whitespace
- Iterate over ALL nodes and compute a score: Levenstein distance between the last component of location and the input text.
- Sort all nodes based on the score.
- Print 10 results with lowest score.
Click to show internal directories.
Click to hide internal directories.