Support offsets in prefix searches (just in case)

This code isn't actually used, it's just a copy-paste of code from some
other extension (probably MWSearch). But we may as well clean it up for
I7a27a64e to avoid subtle bugs if someday someone does use it.

Change-Id: I48c5e2ebb01f55e33b5474ee49b9d37baf672c62