Join the discussion
Write your take first — we'll ask for email only when you're ready to publish.
- Hacker News
- Autocomplete aside, this is a pretty nifty tool.by pupppet
- KeyDown events don’t work great for mobile, though.by cortesoft
- >I've designed the API to first search Tranco (the head), and then CZDS (the tail) if necessary.
How do you know if it's necessary? If Tranco returns less than eight?
by andai - Tranco is only top 1M domains.by whalesalad
- Looks more like 500ms?by bagels
- Where did you get that?? Did you even read the post?by konsalexee
- I just typed a random sequence of the characters, long enough to be certain such domain doesnt exist. No only, the browser send an autocomplete request for every keystroke but for each request it returned a set of proposed domain names (which I'm 100% certain doesnt exist). At this point, how do I understand which results are legit and which are fake? Also, it would be nice to highlight the typed part in the result set so I can visually see what matches exactly.by piterrro
- You're not the first to mention this, so clearly users expect something different from what I've designed it for. I think I'll drop the TLD postfix suggestions.by pul
- For the nonexisting domains, it seems like it only autocomplete with the possible domain extensions, (e.g .com, .org, ....) as the search list is non-exhaustive. But it could indeed be improved by not sending autocomplete requests anymore.by addag
- Clever but that’s not how we measure latency.by camel_gopher
- When it comes to UX, perceived latency is king.by dbalatero
- Tangentially, I built something similar a few years back, at link-archive.org: https://web.archive.org/web/20220127233707/https://link-arch...
3B existing URLs extracted from CommonCrawl, with instant search results. It was a fun project but didn't serve much real-world purpose besides curiosity and discovery. So I eventually ditched it, primarily because the link DB was a whopping 500 GiB in size, too much to just keep hosting.
I just used SQLite FTS5 as the backend search engine. Just a few lines of code, but immediate response from a 0.5 TiB DB. SQLite is amazing.
by phil294 - If you’d like to reduce the network latency further you can store each trie node as a file, naming it conveniently the prefix path to that node. Then dump the few hundred million files onto R2.
Now the traversal can be done completely via CDN lookups!
by kevmo314 - Cloudflare R2 doesn't distribute files globally. They only cache requested files in PoPs. So then it would function the same as an API behind the Cloudflare CDN.by pul
- Why not just trigger the fetch on keyDown and show it as soon as the response arrives, as usual?
The time it takes to press a key is a reasonable target to aim at for API latency I suppose, but it is still an arbitrary target. Waiting to display until keyUp just adds more latency if your API is faster. Having it synced with keyUp doesn't make it feel more immediate to me.
by oersted - It’s usually good to wait for user to do KeyUp before treating the string as final. A fellow commenter explained some of the reasons: https://news.ycombinator.com/item?id=49505993by s4i
- Unfortunately this approach doesn't feel that great down here in Australia, definitely a function of latency.
I think you could get a lot closer by framing this as an optimization problem, where you use the full alphabet dictionary, but add a residual prediction which aims to cover as much of the remaining domain name tree as possible weighted by popularity. This tree could then be pre-baked and stored with the same system. This would probably get you p99 0ms even in Australia.
- Interesting, I didn't think of that yet.
I think most people search for domains they own, which doesn't correlate with Tranco popularity ranking. Treating 'popularity' not as a function of visitors, but as a function of number of known domain names with that prefix could work, though.
by pul - Using keyup makes no sense and is inconsistent with user expectations. For triggering actions (which includes normal typing), you only ever use keydown. (Well, there’s one exception for reasons unclear to me: activating a button by pressing Space. That triggers on keyup like how clicks are on release, while Enter triggers on keydown.) Keyup is limited to things where you’re constantly reacting to the state of a key, as is common in games.
This affects the functionality, too. It is in fact introducing latency by using keyup instead of keydown. Feels bad.
by chrismorgan - On my own computer I can open a context menu and select an action with a single click. Whenever I need to use MS Windows, I always need two and I find that infuriating every time.by 1718627440
- this is backwards. Go on.... try it anywhere. Just the start menu (if you're on windows) is enough.by vrighter
- That’s where the input event is really useful as it allows for more input options than just keyboard and then you don’t have to deal with figuring out if it’s down or up.by dawnerd
- As a user, I’ve not thought too much about this before now. I agree with you mostly, but the keyup on space behaviour actually feels so innate I’d hate any change to it. Keydown on space is “jump”; nothing else.by zxexz
- Key down is used for events that can be duplicated by holding the key. Eg in a text editor, when you want multiples of the same letters, you’d press and hold the key.
Key up is used for when it’s important to only have one occurrence of that event.
Technically you could write code that made key down only react once. But the logical separation makes some sense.
by hnlmorg - For triggering actions (which includes normal typing), you only ever use keydown.
I think you have this wrong, actions generally occur on button release, until that you can move the mouse cursor to a different target, tab to another control, use [ESC] to cancel, and so on. Typing, moving a slider with the cursor keys, and similar things that make use of key repetition while holding down the key are the exception to this.
by danbruc - This autocomplete suggests domains that don't exist. You can just type garbage and it will suggest something, but then if you go there, there are no records.
It seems like one purpose of an autocomplete box is help you avoid typos, so that makes it less useful.
by skybrian - That's also the old behaviour of browsers and the current one of text browsers. I fail to see how this is wrong.
$ lynx doesnotexist2 Looking up doesnotexist2 first Looking up www.doesnotexist2.com, guessing... Looking up www.doesnotexist2.edu, guessing... Looking up www.doesnotexist2.net, guessing... Looking up www.doesnotexist2.org, guessing... Can't Access `file://localhost/home/user/doesnotexist2'by 1718627440 - This behavior seems to happen only when there is no more words in the list that can complete the current string. Otherwise, it shows only existing domains.
I guess this behavior helps to autocomplete the domain extension for less-known domains that are not in the search list.
by addag - The autocomplete seemed to suggest real domains to me. If you typed in garbage it suggested the garbage plus a bunch of common TLDs - that seems like a reasonable choice to me. In any case, if your issue is the list of domains to suggest, its trivial to change that to a different list.by bawolff
- Yes, OP seems to have completely lost touch with what is actually useful vs optimizing metrics for the sake of it.