Hi,

When adding an index to another one using add_indexes I get duplicates
even though I use the :key attribute. For example:

def test_add_indexes_uniqueness
        index1 = Ferret::Index::Index.new(:key => :id)
        index2 = Ferret::Index::Index.new(:key => :id)

        # Add two items with same id
        index1 << {:id => 23, :data => "This is the data..."}
        index1 << {:id => 23, :data => "This is the new data..."}
        assert_equal(1, index1.size)

        index2 << {:id => 23, :data => "This is the new data..."}
        assert_equal(1, index2.size)

        # Add index2 to index1
        index1.add_indexes(index2)

        #Size should still be 1 as the items in both indexes have id 23
        assert_equal(1, index1.size)
    end

Here the final assertion fails because the size is 2. What have I
misunderstood? How can I maintain uniqueness when merging indexes?

Thanks,
Lars
_______________________________________________
Ferret-talk mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/ferret-talk

Reply via email to