Hi Pat, thank you for the answer.
Actually i'm using just the ruby/rails core testing (not rspec or
cucumber or something else).
So i've added to my env.rb (using an initializer):

  ThinkingSphinx.deltas_enabled         = true
  ThinkingSphinx.updates_enabled        = true
  ThinkingSphinx.suppress_delta_output  = true

Then in my model_test.rb i've written a simple test:

  def test_simple_test
    ThinkingSphinx::Configuration.instance.build
    ThinkingSphinx::Configuration.instance.controller.index
    ThinkingSphinx::Configuration.instance.controller.start
    results = Model.full_text_search('')
    assert_equal 2, results.total_entries
    assert_equal models(:second), results[0]
    assert_equal models(:first), results[1]
    ThinkingSphinx::Configuration.instance.controller.stop
  end

And it's working! :)

The only problem i've got is when i have something like this:

  def test_simple_test
    assert_equal 'abc', models(:second).detail.tag
    models(:second).detail.update_attribute(:tag, 'abc')
    ThinkingSphinx::Configuration.instance.build
    ThinkingSphinx::Configuration.instance.controller.index
    ThinkingSphinx::Configuration.instance.controller.start
    results = Model.full_text_search(:conditions => {:tags => 'cde')
    assert_equal 0, results.total_entries
    ThinkingSphinx::Configuration.instance.controller.stop
  end

This is the correct test, but i get one result: the :second item,
which i updated the tag value to another value. It seems that it
doesn't get the new value when sphinx reindex. I've tried to puts the
tag facets and instead of 'abc' there is nil... any idea of the
possible cause?
--~--~---------~--~----~------------~-------~--~----~
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