# Search for wb.camra.org.uk doesn't return any results

**URL:** https://meta.discourse.org/t/search-for-wb-camra-org-uk-doesnt-return-any-results/67733
**Category:** Bug
**Created:** [8월 9, 2017, 8:21오후 UTC](https://meta.discourse.org/t/search-for-wb-camra-org-uk-doesnt-return-any-results/67733 "2017-08-09T20:21:06Z")
**Posts on this page:** 18
**Page:** 1

<div class="post-metadata">

### Author: ![Rob\_Nicholson](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/rob_nicholson/32/63483_2.png) [@Rob\_Nicholson](https://meta.discourse.org/u/Rob_Nicholson)
#### Post date: [8월 9, 2017, 8:21오후 UTC](https://meta.discourse.org/t/search-for-wb-camra-org-uk-doesnt-return-any-results/67733/1 "2017-08-09T20:21:06Z")

</div>

Anyone hazard a guess why searching for “[wb.camra.org.uk](http://wb.camra.org.uk)” doesn’t find any posts when that text is most certainly in a post. Whereas a search for “wb.camra” does work.

 ![image](https://global.discourse-cdn.com/meta/original/3X/e/a/ea70c12bf60482704f99a84135c4912ea8cfd087.png)

Kind of proving the text does exist as I asked the same question in our own support category:

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

---

<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: [8월 10, 2017, 12:32오전 UTC](https://meta.discourse.org/t/search-for-wb-camra-org-uk-doesnt-return-any-results/67733/2 "2017-08-10T00:32:04Z")

</div>

My guess is “camra” is the only string long enough to get past the minimum search limits. I suspect “camra” is all you are really searching for there.

---

<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: [8월 10, 2017, 9:03오후 UTC](https://meta.discourse.org/t/search-for-wb-camra-org-uk-doesnt-return-any-results/67733/3 "2017-08-10T21:03:07Z")

</div>

So why does adding _more_ break the search? Now that this post has been made, it’s reproducible here on Meta.

---

<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: [8월 10, 2017, 9:05오후 UTC](https://meta.discourse.org/t/search-for-wb-camra-org-uk-doesnt-return-any-results/67733/4 "2017-08-10T21:05:34Z")

</div>

Remember that in normal human being talk, periods end sentences.

So you definitely wouldn’t want to search for just “org” or “wb” or “uk”.

Long unique strings is where it’s at, from a searching perspective. Searching for “to” or “by” ain’t not never no good no how.

---

<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: [8월 10, 2017, 9:26오후 UTC](https://meta.discourse.org/t/search-for-wb-camra-org-uk-doesnt-return-any-results/67733/5 "2017-08-10T21:26:33Z")

</div>

But a search for “wb org uk” does find the first post.

---

<div class="post-metadata">

### Author: ![Rob\_Nicholson](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/rob_nicholson/32/63483_2.png) [@Rob\_Nicholson](https://meta.discourse.org/u/Rob_Nicholson)
#### Post date: [8월 10, 2017, 9:33오후 UTC](https://meta.discourse.org/t/search-for-wb-camra-org-uk-doesnt-return-any-results/67733/6 "2017-08-10T21:33:01Z")

</div>

> [@codinghorror](#):
>
> Remember that in normal human being talk, periods end sentences.

I would say searching for website addresses is a pretty common requirement as it’s a unique identifier. And yes, it is now repeatable on here. I think people would complain if searching for [www.bbc.co.uk](http://www.bbc.co.uk) didn’t work on Google.

Maybe somebody who knows how the search engine works could comment on what Discourse is doing with the search string? Is it getting processed so that it’s not searching on what one types?

Later… and yes, having included [www.bbc.co.uk](http://www.bbc.co.uk) in this message, Discourse is unable to find 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: [8월 10, 2017, 9:37오후 UTC](https://meta.discourse.org/t/search-for-wb-camra-org-uk-doesnt-return-any-results/67733/7 "2017-08-10T21:37:19Z")

</div>

searching for `camra.org` seems to work OK. As does `camra`.

As to what bits of Postgres innards don’t like `camra.org.uk` and `wb.camra.org` and `wb.camra.org.uk` I can’t say. There is a reason there are tens of thousands of people working at Google, and literally nobody uses Bing even though it air-quotes “works”

---

<div class="post-metadata">

### Author: ![DeanMarkTaylor](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/deanmarktaylor/32/102462_2.png) [@DeanMarkTaylor](https://meta.discourse.org/u/DeanMarkTaylor)
#### Post date: [8월 10, 2017, 9:53오후 UTC](https://meta.discourse.org/t/search-for-wb-camra-org-uk-doesnt-return-any-results/67733/8 "2017-08-10T21:53:15Z")

</div>

Although this is not exactly the same issue - something that might be relevant is this:

@sam did put a fix in for something similar to this sort of thing back in July 2016:  
[https://github.com/discourse/discourse/commit/12ecf8624a97c3d33aaa3cd56851b5f1ca347c90#diff-995f4013dde76fb0460ecdb36fa20d53](https://github.com/discourse/discourse/commit/12ecf8624a97c3d33aaa3cd56851b5f1ca347c90#diff-995f4013dde76fb0460ecdb36fa20d53)

Where the last word wasn’t searchable.

Although the file `app/models/search_observer.rb` doesn’t seem to exist in the current version of the code I assume those fixes are still in there somewhere…

Because the tests still exist for it:  
[https://github.com/discourse/discourse/blob/master/spec/components/search\_spec.rb#L701-L704](https://github.com/discourse/discourse/blob/master/spec/components/search_spec.rb#L701-L704)

But as I said before - perhaps a slightly different issue.

* * *

EDIT: found the current relevant code:

> <https://github.com/discourse/discourse/blob/main/app/services/search_indexer.rb#L23-L31>

---

<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: [8월 10, 2017, 10:56오후 UTC](https://meta.discourse.org/t/search-for-wb-camra-org-uk-doesnt-return-any-results/67733/9 "2017-08-10T22:56:34Z")

</div>

> [@codinghorror](#):
>
> There is a reason there are tens of thousands of people working at Google, and literally nobody uses Bing even though it air-quotes “works”

I don’t really buy the “Google is awesome at search, therefore no point improving search cause Google is awesome at search” argument 😜

---

<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: [8월 10, 2017, 10:57오후 UTC](https://meta.discourse.org/t/search-for-wb-camra-org-uk-doesnt-return-any-results/67733/10 "2017-08-10T22:57:13Z")

</div>

There is absolutely point in improving, but we may need to hire 10,000 folks to reach parity with Google’s efforts..

---

<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: [8월 10, 2017, 10:57오후 UTC](https://meta.discourse.org/t/search-for-wb-camra-org-uk-doesnt-return-any-results/67733/11 "2017-08-10T22:57:52Z")

</div>

Sure, but… I can fix this specific bug

---

<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: [8월 10, 2017, 11:08오후 UTC](https://meta.discourse.org/t/search-for-wb-camra-org-uk-doesnt-return-any-results/67733/13 "2017-08-10T23:08:24Z")

</div>

Is this a bug in your code, then? Is that what you’re saying?

---

<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: [8월 10, 2017, 11:11오후 UTC](https://meta.discourse.org/t/search-for-wb-camra-org-uk-doesnt-return-any-results/67733/14 "2017-08-10T23:11:31Z")

</div>

The pg tokenizer is dumb, I already have workarounds for some edge cases, this is another example

---

<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: [8월 10, 2017, 11:20오후 UTC](https://meta.discourse.org/t/search-for-wb-camra-org-uk-doesnt-return-any-results/67733/15 "2017-08-10T23:20:09Z")

</div>

Maybe there will be some improvements when we upgrade to PG 10 later this year.

---

<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: [8월 10, 2017, 11:29오후 UTC](https://meta.discourse.org/t/search-for-wb-camra-org-uk-doesnt-return-any-results/67733/16 "2017-08-10T23:29:17Z")

</div>

Have not done root cause analysis here, this could very much be a bug in my code for all I know

---

<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: [8월 11, 2017, 2:35오전 UTC](https://meta.discourse.org/t/search-for-wb-camra-org-uk-doesnt-return-any-results/67733/17 "2017-08-11T02:35:15Z")

</div>

> [@Rob\_Nicholson](#):
>
> [wb.camra.org.uk](http://wb.camra.org.uk)

It looks like it tokenizes right, at least on my local install and meta.

```plaintext
[5] pry(main)> Post.exec_sql("SELECT * FROM ts_debug('english', 'wb.camra.org.uk');").to_a
=> [{"alias"=>"host",
  "description"=>"Host",
  "token"=>"wb.camra.org.uk",
  "dictionaries"=>"{simple}",
  "dictionary"=>"simple",
  "lexemes"=>"{wb.camra.org.uk}"}]

```

So this is likely an implementation bug on our side.

---

<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: [8월 14, 2017, 8:21오후 UTC](https://meta.discourse.org/t/search-for-wb-camra-org-uk-doesnt-return-any-results/67733/18 "2017-08-14T20:21:53Z")

</div>

Fixed per:

[https://github.com/discourse/discourse/commit/6002f2ca4ac0657c8129b492d997d13889bdda12](https://github.com/discourse/discourse/commit/6002f2ca4ac0657c8129b492d997d13889bdda12)

Thanks @DeanMarkTaylor for finding the exact reason for the bug!

Note you will need to re-index posts with said issue, which means you have to edit them (I am not 100% sure if rebake will catch this)

search for: [wb.camra.org.uk](http://wb.camra.org.uk) 🔍

---

<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: [8월 15, 2017, 10:00오후 UTC](https://meta.discourse.org/t/search-for-wb-camra-org-uk-doesnt-return-any-results/67733/19 "2017-08-15T22:00:29Z")

</div>

This topic was automatically closed after 25 hours. New replies are no longer allowed.
