Code review comment for lp:~julian-edwards/maas/better-search

Revision history for this message
Raphaƫl Badin (rvb) wrote :

> Woops, needs a unique! Thanks for spotting.

It needs a unique indeed. But it has nothing to do with the union:
This is a way to trigger the problem: http://paste.ubuntu.com/8803036/ (fwiw, this is the query this generates http://paste.ubuntu.com/8803039/).

The problem is that querying across manytomany relationships gives you an effective join. Hence the duplication. This makes perfect sense from an SQL point of view but from an ORM point of view (i.e. Nodes.objects.filter()), it's a bit weird, I'll give you that.

Also, you can make the code is a tad nicer: http://paste.ubuntu.com/8803384/

« Back to merge proposal