

Show HN: Hacker News Instant (3 hour project) - vnorby
http://hninstant.com

======
kwamenum86
Looks good. Except when you type a single space character the app enters into
an infinite loop making it very difficult to do anything else in the browser
(Chrome). Even navigating the window to a different page is impossible.

[Edit] Scratch that. Typing anything followed by a space character tends to
make things crash. Why would this happen? I find this bug interesting. Let me
know what the problem was when you fix it.

[Edit2] Okay looks like the problem may be with anything that needs to be url
encoded.

[Edit3] I think the problem comes down to your call to encodeURIComponent in
your search function and the behavior when the hash changes. Basically, we
enter the search function when the hash changes. But then you call
encodeURIComponent and assign the result to the hash. If the query contains
characters that need to be escaped then the new value is different (meaning
the hash changes), which means that your search function is going to get
called ad infinitum.

In order to fix this I think you need to do two things. 1) Keep track of the
in flight request unencoded and 2) if your search function is triggered by a
hash change decode the query and compare it to your in flight request. If they
are the same then you can bail out of the search function early. Otherwise you
should cancel the in flight request and launch a new one.

~~~
garb
how come this post is still on top with such a serious bug? Hitting space
makes it enter into infinite loop. It crashed my browser while I was in middle
of something important.

~~~
kwamenum86
I don't think the bug makes it any less noteworthy.

------
chengmi
Little known fact: SearchYC does instant search if you add &instant=true to
the URL:
[http://searchyc.com/hacker+news?sort=by_date&instant=tru...](http://searchyc.com/hacker+news?sort=by_date&instant=true)

It's not enabled by default because it's not as useful without autocomplete.

~~~
helwr
I thought you were shutdown by Comcast, nice to see you're back

~~~
duck
It is still down here.

~~~
chengmi
It's been a rough week. Hopefully things will return to normal once DNS
propagates.

------
vnorby
Using new HNsearch.com APIs, designed, developed, launched in 3 hours. More
coming, this is about as MVP as it gets. Same ranking algorithm as used on
HNSearch.com. BTW, hidden feature...you can double click words in search
results to load a search for that term.

------
nicklovescode
I built the same thing, was planning on finishing the app and buying the
domain tomorrow.

Oh well, this is better than what I would have had anyway.

<http://nickcammarata.com/hninstant/>

~~~
martinshen
I like your implementation/UI better... very little change from the existing
site!

~~~
nrbafna
yes. but please add a bit of left margin to the search box.

------
BoppreH
Maybe hide the "0 points" in every submission until pg brings visible karma
back?

~~~
vnorby
Done, thanks.

------
planckscnst
I found its messing with history incredibly annoying. Here's why...

Every single letter typed creates a new history item. It got to the point
where so many history items were added that HN was pushed out of my history: I
couldn't use "back" to get back to HN. I had to type in the URL to get to HN,
then I had to find the comments page to get back here again to see the
discussion.

I continued on looking at other HN stories. Once, I went back too far and
landed on the HNI page again. I typed "L" as one does in Vimperator and
Pentadactyl to go forward and get back to HN. The only problem was the text
box stole my input, this resulted in a new query and a new history item,
erasing, once again, HN's history item. I had to (again) type the URL to get
here!

~~~
vnorby
I'm sorry - what I've done now is only updated the history/hashtag when
hitting enter, similar to Google Instant search.

------
asanwal
Interesting idea but on my first query, it locked up Chrome on me and went
absolutely batsh1t crazy. Had to shut down Chrome and relaunch it.

Will wait for MVP2.0

------
Kilimanjaro
Love it. Give me the possibility to search titles only (a checkbox) and this
will be my favorite search tool for HN.

~~~
vnorby
Done, there ya go.

------
askar_yu
"3 hour project" - I wonder what the author's intent is to point out that it
took him 3 hours to implement? (I've equally been curious about the ones where
people share their _weekend_ projects and remark it explicitly)

~~~
zbanks
Both signify that the project was done quickly & may have bugs. Also, they
aren't necessarily attempting to turn the project into a business, or even
make money off the project.

It's a warning. They aren't looking for startup advice, they just want to show
a (hopefully) helpful project that may have a few bugs.

------
tzury
you should cache local results, so as I type:

    
    
        drop > dropb > dropbo > dropbox
    

I get no white screen in between, rather previous list filtered

~~~
kwamenum86
Based on the way the search API works I don't think this is feasible. "dropb"
is not a token that the system recognizes as being part of "dropbox" so I
think dropb essentially returns no results. It would be nice if they had some
sort of autocomplete functionality. That is how Google Instant works- it makes
an educated guess at what your query will be and uses that rather than using
the partial query. It's pretty effective much of the time.

Seems like ThriftDB is still in a pretty early stage of development so I doubt
that they support this. But autocomplete is a solved problem so I'd be
surprised if it doesn't make it in at some point.

~~~
andres
We definitely want to add autocomplete to ThriftDB.

~~~
kwamenum86
Yeah I feel like you can't have true instant search without autocomplete. Lots
of people don't realize that the reason Google's instant search is effective
is that they can tell what you are going to type before you finish typing it.
Autocomplete would be huge.

You guys can probably do a pretty effective version right now but I imagine
data about what people are searching for allows you to create a better
autocomplete feature. And that data only comes with time.

------
agilo
Interesting. Is it normal that the browser's back button is essentially
rendered useless after a query or two?

~~~
vnorby
Back button support should be there (for most browsers) :)

~~~
robryan
It's on a letter by letter basis though, maybe best to only update the browser
hash say after a second or more of no letters added to the search bar.

~~~
lightyrs
Upvote.

~~~
vnorby
What I've done for now is only updated the history/hashtag when hitting enter,
similar to Google Instant. They have some other conditions in there as well,
but there's not a whole lot of a use-case on here for wanting to use the back
button within a search query.

------
stuntgoat
Nice work. Could you highlight queries?

------
comatose_kid
Nice work Vib!!

------
ujjvala
No thank you. <http://i.imgur.com/bywAE.png>

~~~
eliben
Why such a negative approach? Wouldn't it be more useful to specify how to
reproduce the problem, to let the author fix it?

