dcramer / django-sphinx

A transparent layer for full-text search using Sphinx and Django
http://groups.google.com/group/django-sphinx
BSD 3-Clause "New" or "Revised" License
357 stars 122 forks source link

Comparison operations with SphinxProxy objects violate symmetry #18

Open forcefield opened 14 years ago

forcefield commented 14 years ago

The current implementation of eq, cmp in SphinxProxy violates symmetry. For instance, suppose you have

a = Object() b = SphinxProxy( a )

You have b==a return True, but a==b return False, and even b==b return False.

This makes it awkward to use SphinxProxy object directly in further queries, such as

get_object_or_404( id = b )

will fail because it is trying to use the eq operator treating b as the second argument.

Any way to improve this behavior?