Code Monkey home page Code Monkey logo

hummingbird.js's Introduction

Hummingbird.js

Impossibly quick and remarkably precise

Misspellings and nicknames are no match for this fast and forgiving typeahead engine. You can index any JavaScript object you like with id and name, and hummingbird.js will merrily make it searchable. No schema needed, it just matches against name and returns the document.

  • id serves as the key, this needs to be unique in an index.
  • name is the indexed text, just build up a property. Any other properties are just carried along, but are not indexed.
    var idx = new hummingbird.Index();
    idx.add({id: 1, name: 'Hi Mom', female: true});
    idx.add({id: 2, name: 'Sup Dad', male: true});
    idx.search('Dad', function(results){
        results.forEach(function(doc){
            console.log(doc);
        });
    });

Browser or Server

Hummingbird is designed to run 100% in the browser for reasonably sized lists of names (i.e., those that will fit into the users available RAM). If you need to run a server-side solution (e.g., for large indexes or other reasons), please take a look at Nectar http://github.com/glg/nectar

What goes into a hummingbird index

Hummingbird is specifically focused on typeahead results, but often you'll need to display more than just the name of something for the user to make a selection decision. To that end, the ideal hummingbird index should contain:

  • the name of the thing on which to select
  • a unique id on which one might take action
  • meta data that enables the user to disambiguate between similarly named items
  • meta data that enables further action on selected items.

e.g.,

  • name: Steve Quince
  • id: 1235
  • company: Gerson Lehrman Group
  • location: Boston, MA
  • telephone: 617-555-1212
  • email: [email protected]

Read more...

hummingbird.js's People

Contributors

squince avatar dgriffis avatar asegal avatar wballard avatar nswarr avatar

Watchers

James Cloos avatar  avatar  avatar

hummingbird.js's Issues

Consider providing explicit support for hit-highlighting

Think about the best way to support this in a relatively generic way. The goal is to make it as friction free as possible for consuming developers to present a compelling user experience

  • return matching tokens per doc?
  • provide a utility for wrapping a dom element with spans?

Document use case examples

Create several use cases to demonstrate features:

  • threshold for minimum scores
  • size of ngrams (perhaps double-byte vs latin)
  • prefix boosting
  • data persistence to local storage
  • personal Rolodex search

Eliminate the use of Grunt

  • upgrade diacritics to latest version and pin it there
  • implement webpack
  • remove all dev-dependencies for "building"

migrate away from coffeescript to ES6 javascript

  • convert each coffeescript file to javascript
  • ensure tests still run
    • now using http-server switched to webpack-dev-server
    • need to ensure that tests are being re-run properly by breaking, then fixing functionality or test

Generate API documentation

  • incorporate a jsdoc documentation generator
  • script the generation of the documentation as markdown
    • probably just in package.json
  • clean up code comments and regenerate

Consider reworking tests using Mocha or Jest

  • try mocha
  • try jest - after reading up, decided to stick with mocha
  • decide on library/run/report convention
  • rewrite all existing unit tests
    • event emitter
    • index tests
    • meta store tests
    • non-latin tests
    • search tests
    • serialization tests
    • token store tests
    • tokenizer tests
    • variant store tests

Create documentation site

  • use docusaurus or similar
  • create github pages
  • automate updates
  • consider whether to include versioning
    • Probably easiest to just bake that into the code comments?

Consider providing a web component

Can serve as a reference implementation and a basic barebones solution. Bake in rudimentary related features such as:

  • hit highlighting
  • debounce autosearch while user types

Refactor Sweep

  • look through all source code again and update syntax to be more modern and streamlined as appropriate
    • token_store
    • indexer
  • refactor search function into smaller chunks
  • remove unnecessary build config/code (e.g., bower, grunt, etc.)

Convert to ES6 Classes

Document using jsdoc comment syntax.

  • event_emitter.js
  • hummingbird.js
  • index.js
  • meta_store.js
  • token_store.js
  • tokenizer.js
  • utils.js
  • variant_store.js

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.