Find the number of where statements that matched in postgresQL
One way:

SELECT id 
FROM   products 
WHERE  details-&gt;'make' = ? 
    OR details-&gt;'model' = ? 
    OR details-&gt;'year' = ?
ORDER  BY CASE WHEN details-&gt;'make' = ?  THEN 0 ELSE 1 END
        + CASE WHEN details-&gt;'model' = ? THEN 0 ELSE 1 END
        + CASE WHEN details-&gt;'year' = ?  THEN 0 ELSE 1 END;


It's a bit simpler to invert the logic:
NULL and FALSE results increase the value (and decrease the ranking).