Coder Social home page Coder Social logo

alphagov.rummageable's Introduction

Rummageable (DEPRECATED)

This gem is deprecated. Please use gds-api-adapters.

Rummageable is a ruby gem to simplify communication with Rummager to create/update/remove items in the gov.uk search index.

It attempts to handle networking errors by retrying failed requests a few times before it'll give up, and will optionally log it's success/failure to a logger object (if you give it one).

Usage

To interact with Rummager, create an instance of the Rummageable::Index class:

index = Rummageable::Index.new('http://localhost:3009', 'index-name')

You can also pass a logger to new, and can control how aggressively Rummageable will retry your command in the event of an error. See the source for details.

Getting started

You can add individual indexable "things" to a Rummager index by passing a hash that represents the thing you want to index:

document = {
  'title' => 'Child benefit tax calculator',
  'link' => '/child-benefit-tax',
  'format' => 'smart-answer',
  'section' => nil,
  'subsection' => nil
}
index = Rummageable::Index.new('http://localhost:3009', 'index-name')
index.add(document)

The link key is special; you can use it to amend/delete the document's entry in the index later, with the Index#amend and Index#delete methods.

If you've got a large collection of documents the add_batch method will chop the collection up into manageable chunks and send them to Rummager for you.

index.add_batch(array_of_documents)

See the source of the Rummageable::Index class for other methods.

alphagov.rummageable's People

Contributors

bradwright avatar chrisroos avatar craigw avatar daibach avatar davidslv avatar dhwthompson avatar elliotcm avatar floehopper avatar garethr avatar heathd avatar jabley avatar jamiecobbett avatar jordanhatch avatar jystewart avatar lazyatom avatar mattbostock avatar matthewford avatar rboulton avatar rubenarakelyan avatar threedaymonk avatar tijmenb avatar tomafro avatar

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.