[Metakit] Find fails in hashed view but works in plain view or ordered view.

Thomas Mills Hinkle tmhinkle at gmail.com
Sun Oct 30 23:05:16 CET 2005


I stumbled onto what I think is a buggy situation where find and
select are behaving differently. The following python code should
demonstrate relatively clearly:

>>> cview=storage.getas('category[id:I,category:S]')
>>> metakit.dump(cview)
 id  category
 --  --------
  2  Dessert
 --  --------
 Total: 1 rows
>>> cview.find(id=2)
0
>>> cview.select(id=2)[0].category
'Dessert'
>>> rhsh = storage.getas('__category_hash__[_H:I,_R:I]')
>>> cview_hashed = cview.hash(rhsh,1)
>>> cview_hashed.find(id=2)
-1
>>> cview_ordered = cview.ordered()
>>> cview_ordered.find(id=2)
0
>>> cview[cview_ordered.find(id=2)].category
'Dessert'
>>>

For now, I'm going to workaround by using ordered views instead of
hashed for this particular case, since I think that's what I ought to
have been using for unique numeric IDs anyway.

Nonetheless, I'm still completely puzzled by the behavior. Can anyone
explain what might be going on here?

Thanks,
Tom


More information about the Metakit mailing list