allow filtering for item rating

Support exact, min and max rating filters where
the last two can be combined, but the first has
precedence. Some fixes to existing code were re-
quired due to SQL changes.