Faceted filtering vs side wide search

On some ecommerce websites, when user visits specific category he can narrow results using faceted filtering. Hovewer, text search field (usually placed on top of page) sometimes just redirects user to side-wide search results page.

What if we want to narrow category contents by specific phrase entered into search field (just like we use checkboxes in faceted search), but we also want to give option for side wide search.

What are best practices for using both of these functionalites simultaneously on one website?