Re:Show HN: PageFish search algorithm
by peterburkimsher on Tuesday July 17, 2018 @10:08AM
(#17549814)
The data is in the order it came in from OSMNames.
When there's two elements with the same name (e.g. Geneva), the first result is the most common (the city I was born, not the town in the US).
Also, apparently the files are not sorted by name (or I failed to see it). Searching in a sorted file using binary search is logarithmic, much faster than grepping which is linear.
Sorting can be done once, when the files are formed. BTW inserting into a sorted file should also be pretty fast (cheaper than appending and re-sorting).