# discourse\_api search broken

**URL:** https://meta.discourse.org/t/discourse-api-search-broken/27798
**Category:** Bug
**Created:** [April 21, 2015, 1:29pm UTC](https://meta.discourse.org/t/discourse-api-search-broken/27798 "2015-04-21T13:29:43Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![oganer](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/oganer/32/103794_2.png) [@oganer](https://meta.discourse.org/u/oganer)
#### Post date: [April 21, 2015, 1:29pm UTC](https://meta.discourse.org/t/discourse-api-search-broken/27798/1 "2015-04-21T13:29:43Z")

</div>

Hi, while testing search feature found that search method in discourse\_api doesn’t work. It’s make requests to `/search.json?term=x` but seems it’s wrong. The corrects ways is `/search?search=x` or may be `/search/query?term=x` right?

---

<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: [April 21, 2015, 1:46pm UTC](https://meta.discourse.org/t/discourse-api-search-broken/27798/2 "2015-04-21T13:46:51Z")

</div>

looks like the api gem is out of date, can you send through a PR change it over to `/search/query`

---

<div class="post-metadata">

### Author: ![oganer](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/oganer/32/103794_2.png) [@oganer](https://meta.discourse.org/u/oganer)
#### Post date: [April 21, 2015, 4:54pm UTC](https://meta.discourse.org/t/discourse-api-search-broken/27798/3 "2015-04-21T16:54:09Z")

</div>

Hmmm, i’ve pushed some changes before, which allowed me to request topics by tags.

[https://meta.discourse.org/t/the-official-discourse-tags-plugin-discourse-tagging/26482/29?u=oganer](https://meta.discourse.org/t/the-official-discourse-tags-plugin-discourse-tagging/26482/29)

By the way i can suggest this changes.

[https://github.com/discourse/discourse\_api/pull/74](https://github.com/discourse/discourse_api/pull/74)

---

<div class="post-metadata">

### Author: ![erik\_chan](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/erik_chan/32/115850_2.png) [@erik\_chan](https://meta.discourse.org/u/erik_chan)
#### Post date: [September 10, 2015, 11:42pm UTC](https://meta.discourse.org/t/discourse-api-search-broken/27798/4 "2015-09-10T23:42:43Z")

</div>

No wonder I couldn’t get it to return anything remotely useful 😵

---

<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: [September 10, 2015, 11:47pm UTC](https://meta.discourse.org/t/discourse-api-search-broken/27798/5 "2015-09-10T23:47:32Z")

</div>

@techAPJ can you add to your list?

---

<div class="post-metadata">

### Author: ![erik\_chan](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/erik_chan/32/115850_2.png) [@erik\_chan](https://meta.discourse.org/u/erik_chan)
#### Post date: [September 10, 2015, 11:51pm UTC](https://meta.discourse.org/t/discourse-api-search-broken/27798/6 "2015-09-10T23:51:38Z")

</div>

> [@sam](#):
>
> @techAPJ can you add to your list?

It looks like it has already been changed to `/search/query`? But its still faulty, always returns `{"grouped_search_result"=>nil}`

---

<div class="post-metadata">

### Author: ![techAPJ](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/techapj/32/342990_2.png) [@techAPJ](https://meta.discourse.org/u/techAPJ)
#### Post date: [September 12, 2015, 6:10pm UTC](https://meta.discourse.org/t/discourse-api-search-broken/27798/7 "2015-09-12T18:10:45Z")

</div>

Saerching via API is working fine for me. Just added this example search script and results are as expected..

> <https://github.com/discourse/discourse_api/blob/main/examples/search.rb>

---

<div class="post-metadata">

### Author: ![erik\_chan](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/erik_chan/32/115850_2.png) [@erik\_chan](https://meta.discourse.org/u/erik_chan)
#### Post date: [September 13, 2015, 3:52pm UTC](https://meta.discourse.org/t/discourse-api-search-broken/27798/8 "2015-09-13T15:52:02Z")

</div>

Finally found the problem on my side, this is what I have to do to make it show something useful

client.search(“discourse”, q={} )

---

<div class="post-metadata">

### Author: ![techAPJ](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/techapj/32/342990_2.png) [@techAPJ](https://meta.discourse.org/u/techAPJ)
#### Post date: [September 13, 2015, 4:07pm UTC](https://meta.discourse.org/t/discourse-api-search-broken/27798/9 "2015-09-13T16:07:41Z")

</div>


