TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Show HN: Fast autocomplete service written in Go and JavaScript

76 点作者 peterbe大约 10 年前

15 条评论

corford大约 10 年前
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.
AYBABTME大约 10 年前
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 未加载
mmccaff大约 10 年前
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 未加载
peterbe大约 10 年前
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>
lazyjones大约 10 年前
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 未加载
doomspork大约 10 年前
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 未加载
amelius大约 10 年前
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 未加载
jbeja大约 10 年前
&quot; Fast Redis autocomplete service written in Go and JavaScript &quot;<p>FTFY
评论 #9317382 未加载
bad_user大约 10 年前
It would have been nice to give suggestions even if you make spelling mistakes.
评论 #9317941 未加载
评论 #9317928 未加载
afshinmeh大约 10 年前
Ok, what `fast` means here? There is no database for the server-side project.
评论 #9317181 未加载
评论 #9317301 未加载
peterbe大约 10 年前
20,000 searches have been made in the last post. I love HN!
marcinbejm大约 10 年前
Nice! This will come in very handy for me.
aceperry大约 10 年前
I wonder how they can do this for free?
评论 #9318783 未加载
reinhardt1053大约 10 年前
Does it support unicode?
评论 #9317339 未加载
评论 #9317357 未加载
grigio大约 10 年前
and rust ?
评论 #9318443 未加载