# Using the "search this topic" check box blocks search on other pages

**URL:** https://meta.discourse.org/t/using-the-search-this-topic-check-box-blocks-search-on-other-pages/56832
**Category:** Bug
**Created:** [2월 3, 2017, 1:20오전 UTC](https://meta.discourse.org/t/using-the-search-this-topic-check-box-blocks-search-on-other-pages/56832 "2017-02-03T01:20:21Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![elijah](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/elijah/32/104055_2.png) [@elijah](https://meta.discourse.org/u/elijah)
#### Post date: [2월 3, 2017, 1:20오전 UTC](https://meta.discourse.org/t/using-the-search-this-topic-check-box-blocks-search-on-other-pages/56832/1 "2017-02-03T01:20:21Z")

</div>

I can reproduce this here.

1. Click the Search magnifying glass, enter a term, and check the box for “Search this topic”
2. Click the “Discourse” logo on the upper left.
3. Click the Search magnifying glass: nothing happens.

A little while later it comes back, but I don’t know if it is some activity I’m doing or what that fixes it.

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [2월 3, 2017, 1:21오전 UTC](https://meta.discourse.org/t/using-the-search-this-topic-check-box-blocks-search-on-other-pages/56832/2 "2017-02-03T01:21:54Z")

</div>

This is a legit bug @tgxworld and I think Imgur was reporting it as well?

---

<div class="post-metadata">

### Author: ![tgxworld](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tgxworld/32/106117_2.png) [@tgxworld](https://meta.discourse.org/u/tgxworld)
#### Post date: [2월 3, 2017, 1:23오전 UTC](https://meta.discourse.org/t/using-the-search-this-topic-check-box-blocks-search-on-other-pages/56832/3 "2017-02-03T01:23:29Z")

</div>

Yup it is the same bug and I’m fixing it atm. Problem here is that the search context is not being reset after we navigate away from the route.

---

<div class="post-metadata">

### Author: ![Orajnam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/orajnam/32/66792_2.png) [@Orajnam](https://meta.discourse.org/u/Orajnam)
#### Post date: [2월 3, 2017, 1:30오전 UTC](https://meta.discourse.org/t/using-the-search-this-topic-check-box-blocks-search-on-other-pages/56832/4 "2017-02-03T01:30:55Z")

</div>

> [@elijah](#):
>
> Click the Search magnifying glass: nothing happens

For me, none of the top right buttons work: search, hamburger, or user icon.

**Edit:** When I come back into the topic where I searched, the search is still showing. ie. it didn’t close when I navigated away from the page.

---

<div class="post-metadata">

### Author: ![tgxworld](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tgxworld/32/106117_2.png) [@tgxworld](https://meta.discourse.org/u/tgxworld)
#### Post date: [2월 3, 2017, 3:35오전 UTC](https://meta.discourse.org/t/using-the-search-this-topic-check-box-blocks-search-on-other-pages/56832/5 "2017-02-03T03:35:08Z")

</div>

PR in

[https://github.com/discourse/discourse/pull/4684](https://github.com/discourse/discourse/pull/4684)

I found another bug in the process where we did not refresh the results when the search context has changed/become invalid. If you are searching within a topic and you navigate to the home page and open the search menu again, the search results would still be scoped to the topic that you navigated from.

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [7월 18, 2018, 5:29오전 UTC](https://meta.discourse.org/t/using-the-search-this-topic-check-box-blocks-search-on-other-pages/56832/6 "2018-07-18T05:29:18Z")

</div>

This still acts really really strange … we got to fix it properly.

1. Search for legit here:

 ![image](https://global.discourse-cdn.com/meta/original/3X/4/7/4786332329d0a20fa9514307f11de01a3b2d5bf6.png)

1. Close search by clicking anywhere

2. Click “home”

3. Click “Search”

 ![image](https://global.discourse-cdn.com/meta/original/3X/0/f/0f3d83addf998764a19d65278c6d2f5fecfd0840.png)

@tgxworld can you sort this out so it behaves more sanely… I guess if we are not clearing the term we should at least properly reset the search results so it searches globally for `legit`

---

<div class="post-metadata">

### Author: ![tgxworld](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tgxworld/32/106117_2.png) [@tgxworld](https://meta.discourse.org/u/tgxworld)
#### Post date: [8월 8, 2018, 10:04오전 UTC](https://meta.discourse.org/t/using-the-search-this-topic-check-box-blocks-search-on-other-pages/56832/8 "2018-08-08T10:04:27Z")

</div>

Fixed in  
[https://github.com/discourse/discourse/commit/94622b451a19f0f5152280f146354ab663d06eb8](https://github.com/discourse/discourse/commit/94622b451a19f0f5152280f146354ab663d06eb8)

I’ll need to look at adding the test case next week because it wasn’t straight forward.

---

<div class="post-metadata">

### Author: ![tgxworld](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tgxworld/32/106117_2.png) [@tgxworld](https://meta.discourse.org/u/tgxworld)
#### Post date: [8월 20, 2018, 7:52오전 UTC](https://meta.discourse.org/t/using-the-search-this-topic-check-box-blocks-search-on-other-pages/56832/9 "2018-08-20T07:52:32Z")

</div>

Oops I had to do a take 2 on this and this is properly tested now.

[https://github.com/discourse/discourse/commit/658b55c4068bad41ce6d78ef70303989f9d6c32c](https://github.com/discourse/discourse/commit/658b55c4068bad41ce6d78ef70303989f9d6c32c)

---

<div class="post-metadata">

### Author: ![tgxworld](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tgxworld/32/106117_2.png) [@tgxworld](https://meta.discourse.org/u/tgxworld)
#### Post date: [8월 20, 2018, 7:52오전 UTC](https://meta.discourse.org/t/using-the-search-this-topic-check-box-blocks-search-on-other-pages/56832/10 "2018-08-20T07:52:33Z")

</div>


