Random errors in tests caused by outdated index

1 view
Skip to first unread message

Simone Carletti

unread,
Nov 9, 2009, 11:36:41 AM11/9/09
to Sunspot
I've been experiencing random error in my tests (unexpected results)
and I had hard time trying to figure out which was the issue.

I usually run a couple of similar tests to stress all the possible
behaviors of a single method. The first test passed without any
problem, all consequent tests failed.
I noticed that forcing the rebuild of the index with Model.reindex
resolved the issue so I investigated further and I remember where the
documentation explains that index changes are not immediately
committed.

I changed the after/before filters to use the bang-version of index
and remove_from_index and everything went fine.

What about providing an additional option to enable the user to choose
which strategy the searchable method should implement?

-- Simone

Mat Brown

unread,
Nov 10, 2009, 11:04:35 AM11/10/09
to ruby-s...@googlegroups.com
Hi Simone,

Thanks for the feedback. The bang! method of index changes is
basically just a short hand for "do this and commit" - it's not really
a "strategy", and I think it's important that users of the API issue
commits explicitly, as commits are expensive on the Solr side.

Mat
Reply all
Reply to author
Forward
0 new messages