{"id":15647595,"url":"https://github.com/pat/ts-datetime-delta","last_synced_at":"2025-04-30T13:17:30.183Z","repository":{"id":712259,"uuid":"359061","full_name":"pat/ts-datetime-delta","owner":"pat","description":"Manage delta indexes via datetime columns for Thinking Sphinx","archived":false,"fork":false,"pushed_at":"2015-04-05T00:23:47.000Z","size":212,"stargazers_count":46,"open_issues_count":0,"forks_count":15,"subscribers_count":5,"default_branch":"master","last_synced_at":"2024-12-26T16:11:01.868Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://ts.freelancing-gods.com","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pat.png","metadata":{"files":{"readme":"README.textile","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2009-11-03T07:18:51.000Z","updated_at":"2024-01-29T23:18:33.000Z","dependencies_parsed_at":"2022-07-07T14:31:28.427Z","dependency_job_id":null,"html_url":"https://github.com/pat/ts-datetime-delta","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pat%2Fts-datetime-delta","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pat%2Fts-datetime-delta/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pat%2Fts-datetime-delta/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pat%2Fts-datetime-delta/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pat","download_url":"https://codeload.github.com/pat/ts-datetime-delta/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":233265461,"owners_count":18650037,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-03T12:20:06.854Z","updated_at":"2025-01-10T21:40:19.167Z","avatar_url":"https://github.com/pat.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"h1. Datetime Deltas for Thinking Sphinx\n\nh2. Installation\n\nYou'll need Thinking Sphinx 1.3.0 or later (v3 is now supported since the 2.0.0 release of this gem).\n\n\u003cpre\u003e\u003ccode\u003egem install ts-datetime-delta\u003c/code\u003e\u003c/pre\u003e\n\nIn your Gemfile, you can use it like so:\n\n\u003cpre\u003e\u003ccode\u003egem 'ts-datetime-delta', '~\u003e 2.0.1',\n  :require =\u003e 'thinking_sphinx/deltas/datetime_delta'\u003c/code\u003e\u003c/pre\u003e\n\nOr if you're still on Rails 2, then put this in your @environment.rb@ file with the rest of your gem dependencies:\n\n\u003cpre\u003e\u003ccode\u003econfig.gem 'ts-datetime-delta',\n  :lib     =\u003e 'thinking_sphinx/deltas/datetime_delta'\n  :version =\u003e '\u003e= 2.0.1'\u003c/code\u003e\u003c/pre\u003e\n\nNo matter which version of Rails, you'll need to add the following line to the bottom of your @Rakefile@:\n\n\u003cpre\u003e\u003ccode\u003erequire 'thinking_sphinx/deltas/datetime_delta/tasks'\u003c/code\u003e\u003c/pre\u003e\n\nh2. Usage\n\nFor the indexes you want to use this delta approach, make sure you set that up in your index definition. For Thinking Sphinx v3, that'll look like this:\n\n\u003cpre\u003e\u003ccode\u003eThinkingSphinx::Index.define(:book,\n  :with  =\u003e :active_record,\n  :delta =\u003e ThinkingSphinx::Deltas::DatetimeDelta\n) do\n  # ...\nend\u003c/code\u003e\u003c/pre\u003e\n\nBut for Thinking Sphinx v1/v2, it belongs within your @define_index@ blocks:\n\n\u003cpre\u003e\u003ccode\u003edefine_index do\n  # ...\n\n  set_property :delta =\u003e :datetime\nend\u003c/code\u003e\u003c/pre\u003e\n\nIf you want to use a column other than @updated_at@, you can specify it using the @:column@ option. The same goes for the threshold, which defaults to one day.\n\nAgain, Thinking Sphinx v3 expects these options outside the block:\n\n\u003cpre\u003e\u003ccode\u003eThinkingSphinx::Index.define(:book,\n  :with          =\u003e :active_record,\n  :delta         =\u003e ThinkingSphinx::Deltas::DatetimeDelta,\n  :delta_options =\u003e {:threshold =\u003e 1.hour, :column =\u003e :changed_at}\n) do\n  # ...\nend\u003c/code\u003e\u003c/pre\u003e\n\nBut Thinking Sphinx v1/v2 it goes within the @define_index@ block:\n\n\u003cpre\u003e\u003ccode\u003eset_property :delta =\u003e :datetime,\n  :threshold    =\u003e 1.hour,\n  :column =\u003e :changed_at\u003c/code\u003e\u003c/pre\u003e\n\nThen, 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.\n\nFor example, if you're going to run the delta indexing task every hour, I would recommend setting your threshold to 70 minutes.\n\nTo ensure this rake task is called regularly, it's best to set it up as a recurring task via cron or similar tools.\n\n\u003cpre\u003e\u003ccode\u003erake thinking_sphinx:index:delta\u003c/code\u003e\u003c/pre\u003e\n\nThe shorthand version is:\n\n\u003cpre\u003e\u003ccode\u003erake ts:in:delta\u003c/code\u003e\u003c/pre\u003e\n\nh2. Contributors\n\n* \"W. Andrew Loe III\":http://andrewloe.com/ - Environment variable for disabling merging.\n* \"Kirill Maximov\":http://kirblog.idetalk.com - Handling nil timestamp column values for toggled checks.\n* \"Timo Virkkala\":https://github.com/weetu - Thinking Sphinx v3 compatibility,fix for null timestamps.\n* \"Cedric Maion\":https://github.com/cmaion - Fix for keeping custom options persisted.\n\nh2. Copyright\n\nCopyright (c) 2009-2014 Pat Allan, and released under an MIT Licence.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpat%2Fts-datetime-delta","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpat%2Fts-datetime-delta","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpat%2Fts-datetime-delta/lists"}