Add hook to extract namespace in prefix search

This will allow extensions (namely CirrusSearch) to match namespaces using
their own rules if core can't find the namespace on its own.

Bug: 62322
Change-Id: I17337cd8ce90190bd335c9159e9d3bbb39ba89cd
Merge "Add hook to extract namespace in prefix search"