Closed andrew2net closed 7 months ago
@andrew2net hash you using for identifier creation have "edition" key which is not reflected in output and different from parsed identifier.
But another thing that parsed "Amendment" have default publisher "ISO" which makes it different from identifier made from hash even without edition. I'll fix that.
@mico I noticed when an ID is parsed from string the #to_h
output has empty publisher:
Pubid::Iso::Identifier.parse("ISO 19110:2005/Amd 1:2011").to_h
=> {:publisher=>"", :number=>"1", :year=>2011, :base=>{:publisher=>"ISO", :number=>"19110", :year=>2005, :edition=>nil, :month=>nil, :type=>nil}, :edition=>nil, :month=>nil, :type=>"AMD"}
I clear out empty and nil values before save ID in index. But when ID recreated from the cleared Hash the publisher is not empty:
Pubid::Iso::Identifier.create(number: "1", year: 2011, base: { publisher: "ISO", number: "19110", year: 2005 }, type: "AMD").to_h
=> {:publisher=>"ISO", :number=>"1", :year=>2011, :base=>{:publisher=>"ISO", :number=>"19110", :year=>2005, :edition=>nil, :month=>nil, :type=>nil}, :edition=>nil, :month=>nil, :type=>"AMD"}
When one Pubid is created from Hash and another is parsed from String they aren't equal: