I'm afraid I've hit a wall with this issue. Seems like you're doing  
everything right, and especially since delta indexes don't come into  
play, I'm confused as to why results are being returned. Can you look  
at the database as part of the test, check that the data in there is  
correct?

Better yet (if the data isn't blown away after the test), check your  
database manually, to ensure the data's there outside of Rails  
transactions.

-- 
Pat

On 31/08/2009, at 12:22 PM, mix wrote:

>
> 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