A 7-speed derailer will shift over a 9-speed cassette just fine.
The indexing is done by the shifter.
But you do need to use a 9-speed shifter - or friction shifting - to be able to use a 7-speed derailer on a 9-speed cassette.
You can’t put a 9-speed wheel in an otherwise 7-speed bicycle and get 7 working gears.
You can put a 7-speed cassette on a 9-speed wheel by adding a 4.5mm thick spacer.
Last edited by dabac; 06-04-20 at 12:51 AM.