Separate row compact/expand into class

The code for applying 'shallow' indexing was too specific, this
refactor should be simpler and easier to follow.  Additionally
should be able to implement something following this interface that
realizes the topic list join so we get the real objects and not just ids.

Change-Id: I14e5d392f834efc5caf0762a9fc830585a185476