Only index namespaces when rebuiling general index

Doing it on every index is a waste of time and will fail on first build
because the general index doesn't yet exist.

Also fix some warnings.

Change-Id: I764377f411b26a966cc1d9f14ec965a17615549b
Merge "Only index namespaces when rebuiling general index"