I couldn't figure out how to file a bug (seriously!) but here's how I'm testing it. I have a short Ruby file "test_reindexing.rb":

require 'rubygems'
require 'couchrest'

class SomeModel < CouchRest::ExtendedDocument

  use_database CouchRest.database!('http://localhost:5984/testing')

  def self.load
    20000.times do |i|
      some_model = new
      some_model.type = 'foo'
      some_model.save
    end
  end

  property :type

  view_by :bar, :map => %q{
      function (event) {
        if (event.type === 'quux' && event.bar) {
          emit(event.bar, null);
        }
      }
    }
end

where I can first populate the database:
ruby -r test_reindexing -e SomeModel.load

and then I can have it query a view and see the indexing every time:
ruby -r test_reindexing -e SomeModel.by_bar

To verify that there are no changes other than the revision number and ordering of the views, I take the the MD5 hash of the sorted list of characters in the view record:

ruby -r test_reindexing -e SomeModel.by_bar && curl http://localhost:5984/testing/_design/SomeModel 2>/dev/null | ruby -ne '$_.sub! /"_rev":"[^"]+",/, "";puts $_.split(//).sort.join("")' | openssl md5

-> jp

On Jun 18, 2009, at 2:20 PM, Damien Katz wrote:

Hmm, that's a bug in CouchDB IMO. Can you write a bug with a failing test for that?

-Damien

On Jun 18, 2009, at 5:07 PM, Jim Puls wrote:

On Jun 18, 2009, at 1:10 PM, Damien Katz wrote:

Also, do the order of the views change?

Indeed, I see when I do a raw HTTP GET of the design document that CouchRest is changing the order of the views. Futon, of course - actually my browser parsing the JSON data - was nice enough to alphabetize them for me, completely obscuring the problem.

-> jp


Attachment: smime.p7s
Description: S/MIME cryptographic signature

Reply via email to