# How to stop redirection with blank search term

**URL:** <https://community.swiftype.com/t/how-to-stop-redirection-with-blank-search-term/579>\
**Category:** Helpline\
**Created:** [February 15, 2018, 3:16pm UTC](https://community.swiftype.com/t/how-to-stop-redirection-with-blank-search-term/579 "2018-02-15T15:16:52Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![tmrony](https://sea1.discourse-cdn.com/flex019/user_avatar/community.swiftype.com/tmrony/32/132_2.png) [@tmrony](https://community.swiftype.com/u/tmrony)\
**Post date:** [February 15, 2018, 3:16pm UTC](https://community.swiftype.com/t/how-to-stop-redirection-with-blank-search-term/579/1 "2018-02-15T15:16:52Z")

</div>

How can I stop redirection when I press in the search field?

I want to stop it because pressing enter without entering anything in the field redirects to the result page and shows all the result. I want the redirection only with a valid value in the search field.

---

<div class="post-metadata">

**Author:** ![tmrony](https://sea1.discourse-cdn.com/flex019/user_avatar/community.swiftype.com/tmrony/32/132_2.png) [@tmrony](https://community.swiftype.com/u/tmrony)\
**Post date:** [February 20, 2018, 8:49am UTC](https://community.swiftype.com/t/how-to-stop-redirection-with-blank-search-term/579/2 "2018-02-20T08:49:25Z")

</div>

I have figure it out. query\_filter works fine to control the behavior before search.

```
_st('install', '<INSTALL KEY>', null, {
            hooks: {
                query_filter: function (query) {
                    return !!query.getQueryText();
                }
            })

```
