Giter VIP home page Giter VIP logo

ts-datetime-delta's Introduction

Datetime Deltas for Thinking Sphinx

Installation

You’ll need Thinking Sphinx 1.3.0 or later.

gem install ts-datetime-delta --source http://gemcutter.org

In your environment.rb file, with the rest of your gem dependencies:

config.gem 'ts-datetime-delta',
  :lib     => 'thinking_sphinx/deltas/datetime_delta'
  :version => '>= 1.0.0',
  :source  => 'http://gemcutter.org'

And add the following line to the bottom of your Rakefile:

require 'thinking_sphinx/deltas/datetime_delta/tasks'

Usage

For the indexes you want to use this delta approach, make sure you set that up in their define_index blocks.

define_index do
  # ...

  set_property :delta => :datetime
end

If you want to use a column other than updated_at, you can specify it using the :delta_column option. The same goes for the threshold, which defaults to one day.

set_property :delta => :datetime,
  :threshold    => 1.hour,
  :delta_column => :changed_at

Then, while your Rails application is running, you’ll need to run the delta indexing rake task regularly – as often as your threshold, allowing for some time for the indexing to actually happen.

For example, if you’re going to run the delta indexing task every hour, I would recommend setting your threshold to 70 minutes.

To ensure this rake task is called regularly, it’s best to set it up as a recurring task via cron or similar tools.

rake thinking_sphinx:index:delta

The shorthand version is:

rake ts:in:delta

Contributors

Copyright

Copyright © 2009 Pat Allan, and released under an MIT Licence.

ts-datetime-delta's People

Contributors

pat avatar loe avatar

Stargazers

 avatar

Watchers

James Cloos avatar  avatar

Forkers

onehub

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.