i forgot to paste it and i did some mess :)
it's a method which does some stuff before calling the sphinx search.
Btw i've also tried directly calling sphinx search (to see if my
method was broken) and you can try this:

A much clearer example:

In the db is this structure:

article -> tags

an index collect the tag's name using:
  indexes self.tags(:name), :as => :tags

  def test_simple_test
    assert_equal 1, articles(:second).tags.size # <-- this article has
just one tag
    assert_equal tags(:cde), articles(:second).tags.first # <-- there
is only this object associated to this tag
    # assert_equal 1, tags(:cde).articles.size
    assert_equal 'cde', tags(:cde).name
    tags(:cde).update_attribute(:name, 'abc')
    # here i've also tried with a tags(:cde).reload
    ThinkingSphinx::Configuration.instance.build
    ThinkingSphinx::Configuration.instance.controller.index
    ThinkingSphinx::Configuration.instance.controller.start
    results = Article.search('', :conditions => {:tags => 'cde')
    assert_equal 0, results.total_entries # <-- this is what it should
be, but there is one result... the articles(:second), which has still
associated the old tag.
    # you can for example do a puts results.first.tags.map(&:name) to
see that the tag has the name changed, but sphinx get it anyway
    ThinkingSphinx::Configuration.instance.controller.stop
  end

I've tried all this also in the dev mode using the console and rebuild
the index with ts:in, and all works correctly, so it's just a matter
of the test mode i think. Should i update in same way the tags table
during the test? (how?)
--~--~---------~--~----~------------~-------~--~----~
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