Skip to content

Instantlinks

sean-k edited this page Jun 10, 2011 · 2 revisions

Requirements

  • an indextank_[Ize]'d FORM.

How it works

When you type over an INPUT with InstantLinks, you get RESULTS suggestions that match your 'prefix' query.

For example, for a companies index you'd want to type:

  • fa and find facebook
  • go and find google
  • tw and find twitter
  • in and find indextank ;-)

When rendering the results, it will try to use an image if possible. If there's no image (or it can't find it), just a line of text will be rendered. The same happens with description.

Usage

a basic example:

// go with the defaults
$("#query").indextank_InstantLinks();

a more complex example:

// the image is 'avatar' on my index, and the name of the documents is 'username'
$("#query").indextank_InstantLinks({name: "username", thumbnail: "avatar"});

Options

  • name: The field to search when the user types. It's also used as the 'heading' of the results. Default: "name"
  • url: The field to redirect the user to, when it clicks / selects a result. Default: "url"
  • thumbnail: The field to use to display an icon for the result. Default: thumbnail
  • description: The field to use as results description. Default: "description"
  • fields: The list of fields to fetch when querying. You may override this if you are overriding any of the above. Default: "name,url,thumbnail,description"
  • format: A function that takes each of the results, and renders it on the suggestion box.

Clone this wiki locally