Giter Club home page Giter Club logo

indextank-jquery's Introduction

README

indextank-jquery is a bunch of little building blocks to make your search UX better.

Quick usage

If you just want to see it working on your index, just:

  1. Download a tarball -> https://github.com/flaptor/indextank-jquery/tarball/master
  2. Uncompress it
  3. cd to the extracted directory
  4. Find test.html, and add there your API URL, and INDEX NAME
  5. Point your browser to test.html, and type a query

I like it, how do I use it on my site?

I assume you have a search template, and it has:

  • a FORM on it, with an id.
  • an INPUT element with type=text, and an id. This element is a child of the FORM element above.
  • a DIV element with an id, that we can use to display results.

If you met these requirements, follow these steps:

  1. Copy the <head> element of test.html on the <head> element of your site's template. If you didn't go through the Quick usage section above, place your indextank credentials on it.
  2. Edit the script, so that:
    • the indextank_Ize()'d element matches the FORM id.
    • the indextank_Autocomplete()'d element matches the INPUT id.
    • the indextank_Renderer()'d element matches the DIV id.
  3. Write a query on your search box

OK, but I want results rendered differently. Can I do that?

Sure you can! You'll need to write a format function that takes a result as argument and returns the rendered HTML.

Example

var userFormat = function(item) {
    var r = $("<div></div>").addClass("result").addClass("user")
            .append( $("<img></img>").attr("src", item.avatar ) )
            .append( $("<a></a>").attr("href", item.url).html(item.snippet_name || item.name) )
            .append( $("<span></span>").addClass("location").text(item.hometown || "far far away") );

    // some items need a slightly different rendering
    if (item.is_staff == "true") {
            r.addClass("staff");
    } 

    return r;
};

And then tell your renderer to use it

$("#results").indextank_Renderer({format: userFormat});

Dependencies

indextank-jquery relies on

You can hotlink them from github, download them and serve them yourself, or use google ajax apis. Just make sure you import them in order, before importing indextank-jquery files.

indextank-jquery's People

Contributors

britttheish avatar dbuthay avatar diegobasch avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

indextank-jquery's Issues

No way of perma-linking queries

There's no way to share a search page generated with indextank-jquery.

Proposition:

  • Changing window.location.hash upon querying would make the URLs permalinks.
  • Parse window.location.hash on document.ready, and trigger a query if the hash looks like a query

indextank-jquery with asp.net

Hi, I have a question,
My application is in asp.net, I have done all the steps and the search do correctly, but when I select any of the suggested words or press Enter submit is performed and the page performs a postback me. Is there any way that they do not perform this postback and avoid ugly indeed it does.
Thank you.

Not correct behaviour of instantSearch

I have few products in index with "biema fd1" in index like:

  • Biema FD181BII
  • Biema FD152BII

When I type "biema fd1" instant search gives me only first item. Autocomplete dropdown shows correctly two items, but i don't need autocomplete, I need only to have InstantSearch results.

Any way to resolve this issue?

Paginator

Adding js paginator would be really great!

No way to handle a empty result in ajaxSearch

When runQuery is execute, the event "Indextank.AjaxSearch.success" is triggered. According to the tutorial, IndexTank_Renderer will handle this event rendering every result. But no action is taken if no result is returned.

Could we add an event to handle empty results searches?

Instant search shows results that don't match a query in progress

example: I type d-i and I see results for "discount"

I keep typing my name "diego" and I continue to see results for discount because "diego" is not in the index.

Instead, I should to see "no results for diego" and as I hit backspace go back to queries that yielded results.

Compatibility with previous versions

I had to change the code

return regulars.append(function(i, h) {
return bolds[i] || "";
});

by

return $.each(regulars, function(index, value) {
$(value).append(bolds[index] || "");
});

to make it compatible with jquery 1.3.2
If there is no other problem, we can change it in master branch.

CDNify

This is related to #2, because has to do with fast distribution.

Indextank-jquery should be available on many locations, and not rely on github being online.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.