Add priority-ordered search to pattern matcher.

Search can be truncated or prioritized with this new callback.