I'm not able to get results for recent records when searching using
date ranges. I've been debugging for hours now. Any help would be
appreciated.

Using latest ThinkingSphinx (as of 2009/10/28), Sphinx (0.9.8.1),
Rails (2.3.4), Ruby (1.8.7), and MySQL (Ver 14.12 Distrib 5.0.45) on
Mac OS 10.5.8.

### Article Model
define_index do
  indexes title, :sortable => :true
  indexes body

  has created_at

  set_property :delta => true
end

### Schema
  create_table "articles", :force => true do |t|
    t.integer  "user_id"
    t.string   "title"
    t.string   "synopsis"
    t.text     "body"
    t.string   "state"
    t.integer  "rating"
    t.integer  "view_count"
    t.datetime "created_at"
    t.datetime "updated_at"
    t.boolean  "delta", :default => true,  :null => false
  end

### Console Session
a = Article.create(:user_id => 34, :title => "TS Test", :body =>
"Testing Thinking Sphinx")
=> Leaving out part of results code for privacy reasons
Sphinx 0.9.8.1-release (r1533)
Copyright (c) 2001-2008, Andrew Aksyonoff

using config file '/Users/thade/dev/rails/config/
development.sphinx.conf'...
indexing index 'article_delta'...
collected 2 docs, 0.0 MB
collected 0 attr values
sorted 0.0 Mvalues, 100.0% done
sorted 0.0 Mhits, 100.0% done
total 2 docs, 60 bytes
total 0.168 sec, 358.18 bytes/sec, 11.94 docs/sec
rotating indices: succesfully sent SIGHUP to searchd (pid=11628).
Querying Sphinx:
Querying Sphinx:

>> a.valid?
=> true

>> Article.search :with => { :created_at => 1.day.ago..Time.now }
Querying Sphinx:
=> []

>> 1.day.ago
=> Tue, 27 Oct 2009 21:12:29 PDT -07:00
>> Time.now
=> Wed Oct 28 21:12:26 -0700 2009
>> a.created_at
=> Wed, 28 Oct 2009 21:07:51 PDT -07:00

### Let's 'rake ts:rebuild'

>> Article.search :with => { :created_at => 1.day.ago..Time.now }
Querying Sphinx:
=> []

### Let's try making the range go back further

>> Article.search :with => { :created_at => 30.days.ago..Time.now }
Querying Sphinx:
  Article Load (0.7ms)   SELECT * FROM `articles` WHERE
(`articles`.`id` IN (14))
=> [#<Article id: 14, user_id: 93, title: "Test", synopsis: "Test",
body: "Test", state: "active", rating: nil, view_count: 1, created_at:
"2009-10-06 18:33:15", updated_at: "2009-10-06 18:35:00", delta:
false>]

### Success! We have an article result, although not the most recent
one that was just created

### Let's try searching with terms

>> Article.search 'ts'
Querying Sphinx: ts
  Article Load (0.6ms)   SELECT * FROM `articles` WHERE
(`articles`.`id` IN (16))
=> [#<Article id: 16, user_id: 34, title: "TS Test", synopsis: nil,
body: "Testing Thinking Sphinx", state: "queued", rating: nil,
view_count: nil, created_at: "2009-10-29 04:07:28", updated_at:
"2009-10-29 04:07:28", delta: false>]

### Success! Sphinx has the latest article in there, just not finding
it with the date range search

Any ideas?

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Thinking Sphinx" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/thinking-sphinx?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to