Search: refactor views (#8157)
This was extracted from https://github.com/readthedocs/readthedocs.org/pull/8149/
to make it easy to review.
- Separate this "shared" view into two classes, too many conditionals
otherwise.
- Remove unused `index` query param.