TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Show HN: Fast autocomplete service written in Go and JavaScript

76 pointsby peterbeabout 10 years ago

15 comments

corfordabout 10 years ago
I&#x27;ve found Apache Solr the best approach to building a flexible, fast auto-complete service. Solr can spit results back in json so it&#x27;s dead easy to write a simple API wrapper in whatever language you&#x27;re using (go, python, ruby).<p>You can then stick Varnish in front of the whole lot if the search space is relatively static and not ridiculously huge.
AYBABTMEabout 10 years ago
Consider using package `log` for logging, `fmt.Printf` doesn&#x27;t linearize writes to stdout.<p><a href="https:&#x2F;&#x2F;github.com&#x2F;peterbe&#x2F;autocompeter&#x2F;blob&#x2F;master&#x2F;server.go#L134" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;peterbe&#x2F;autocompeter&#x2F;blob&#x2F;master&#x2F;server.g...</a><p>Also with `log` you don&#x27;t need to add a `\n` at the end, it will do it for you.
评论 #9317541 未加载
mmccaffabout 10 years ago
Clever name, Peter. :)<p>Btw, I noticed a missing &quot;c&quot; in the &quot;url -X POST&quot; example on this page of your docs:<p><a href="http:&#x2F;&#x2F;autocompeter.readthedocs.org&#x2F;en&#x2F;latest&#x2F;api&#x2F;#bulk-upload" rel="nofollow">http:&#x2F;&#x2F;autocompeter.readthedocs.org&#x2F;en&#x2F;latest&#x2F;api&#x2F;#bulk-uplo...</a>
评论 #9317464 未加载
评论 #9318786 未加载
peterbeabout 10 years ago
I blogged about it here: <a href="http:&#x2F;&#x2F;www.peterbe.com&#x2F;plog&#x2F;autocompeter.com" rel="nofollow">http:&#x2F;&#x2F;www.peterbe.com&#x2F;plog&#x2F;autocompeter.com</a>
lazyjonesabout 10 years ago
Meh, it&#x27;s a decent and properly commented implementation, but the interesting stuff is done by Redis, not in Go.<p>I wrote a similar service (JS+Go) 2 years or so ago using only the Go standard library (specifically the excellent index&#x2F;suffixarray and gobs for persistence). It typically got ~3ms response timings (locally) with &gt; 1 million records indexed.
评论 #9317297 未加载
评论 #9319291 未加载
评论 #9317511 未加载
doomsporkabout 10 years ago
I put together an autocomplete service using Ruby and Redis but rather than dealing with the network latency of a remote service I decided to package it up so it could be mounted along side my app: <a href="https:&#x2F;&#x2F;github.com&#x2F;doomspork&#x2F;autocomplete-me" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;doomspork&#x2F;autocomplete-me</a>
评论 #9317290 未加载
评论 #9317348 未加载
ameliusabout 10 years ago
Comments:<p>1. The focus should be on the search box when the page is loaded.<p>2. While typing the word &quot;javascript&quot;, sometimes the amount of results shrinks and immediately increases, resulting in flickery behavior.
评论 #9319137 未加载
评论 #9318769 未加载
评论 #9319140 未加载
jbejaabout 10 years ago
&quot; Fast Redis autocomplete service written in Go and JavaScript &quot;<p>FTFY
评论 #9317382 未加载
bad_userabout 10 years ago
It would have been nice to give suggestions even if you make spelling mistakes.
评论 #9317941 未加载
评论 #9317928 未加载
afshinmehabout 10 years ago
Ok, what `fast` means here? There is no database for the server-side project.
评论 #9317181 未加载
评论 #9317301 未加载
peterbeabout 10 years ago
20,000 searches have been made in the last post. I love HN!
marcinbejmabout 10 years ago
Nice! This will come in very handy for me.
aceperryabout 10 years ago
I wonder how they can do this for free?
评论 #9318783 未加载
reinhardt1053about 10 years ago
Does it support unicode?
评论 #9317339 未加载
评论 #9317357 未加载
grigioabout 10 years ago
and rust ?
评论 #9318443 未加载