pedz
pedz

Reputation: 2349

Hook into browser search

I have web pages that are "endless pages" -- i.e. if the user goes to a URL, they may be presented with only the first 1000 hits. As they scroll down to hit 900, the javascript code will fetch the next 1000 hits and append it to the previous results.

One concern I have is of people using the search inside the browser (e.g. command-F on the Mac, probably control-F on the PC). It would be super duper if I could catch the "reached end of page, cintinued from top" event (using Firefox as my sample browser). Then I could use that event, like a scroll event, to fetch the next page.

Has anyone does something like this?

Upvotes: 2

Views: 444

Answers (1)

Parris
Parris

Reputation: 18408

So this isn't directly an answer to your question, but a recommendation!

So you are trying to use the browser as a full text search. I would recommend something more robust potentially. Also, I've noticed that almost no normal users ever think of using the find feature in their browsers. We may find it obvious but it provides a bad user experience it seems...

You may want to try something like Solr and hooking it into jQuery autocomplete. You can reindex as much as you want, on whatever portion of the database row(s) you want. It'll even prevent your db from getting hit a bunch since Solr queries are performed again it and not your normal db.

Solr also features fuzzy text search would be really useful with the use case you mentioned.

If you are using rails, it is as easy as installing a gem to get started and I believe it even prepackages a version of solr with the gem (I think).

Upvotes: 2

Related Questions