Many of the available design rules determine how any two objects will interact with one another, so there are two queries to allow you to assign a rule to specific combinations of objects. So for your case, your first query might be "OnTopLayer" and the second might be "IsVia". That way the rule will only be invoked when one object is a polygon on the top layer and the second object is a via (the first object being a polygon is implicit in a polygon connect rule). If you left the second query as "All", then the rule will affect the connection of a polygon on the top layer to ANY other object.
If you want to have different types of connections in different situations, you'll need to create multiple polygon connect rules to cover all of your possible conditions and set their priorities appropriately. Generally you'd have on rule with the conditions "All"/"All" at the lowest priority, so that your default connection type will be applied when no other rule is appropriate.
You can invoke different connection types based on polygon name, polygon class, net class, component class, pad class, and a number of other things. The "right" way will depend on your specific requirements and how much effort you want to put into setting up complicated rules.