# Certain numerical substrings are ignored

**URL:** <https://meta.discourse.org/t/certain-numerical-substrings-are-ignored/34207>\
**Category:** Feature\
**Tags:** search\
**Created:** [7 أكتوبر 2015، 3:25ص UTC](https://meta.discourse.org/t/certain-numerical-substrings-are-ignored/34207 "2015-10-07T03:25:15Z")\
**Posts on this page:** 1\
**Showing post:** 7

<div class="post-metadata">

**Author:** ![gdpelican](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/gdpelican/32/81308_2.png) [@gdpelican](https://meta.discourse.org/u/gdpelican)\
**Post date:** [9 أبريل 2016، 9:25ص UTC](https://meta.discourse.org/t/certain-numerical-substrings-are-ignored/34207/7 "2016-04-09T09:25:06Z")

</div>

You’ll be interested in the `post_search_data` table, which stores `tsvector` information about each post (the tsvectors are weighted collections of lexemes / word roots, which postgres can compare to a search term much faster than a raw post body).

The class you’re looking for is `lib/search.rb` which is… well, a bit tangled, but the line which executes the search is here:

> <https://github.com/discourse/discourse/blob/main/lib/search.rb#L475>

If I had a wild guess, I would guess that converting the word ‘chem123’ to a lexeme results in `{'chem123':1}`, which doesn’t match the tsquery `123`

 ![](https://global.discourse-cdn.com/meta/original/3X/b/1/b18e0237d97de0949abd7ed5410493b64aad1656.png)

(The ‘f’ is for false, aka, the document ‘chem123’ isn’t a match for the search term ‘123’)

I definitely don’t have my head around a good fix for that, but I wish you luck! Maybe you could write a clause in there specifically for if the query is a number.

PS I found [this post](http://rachbelaid.com/postgres-full-text-search-is-good-enough/) to be a really great intro to how postgres does its fulltext search.

---

_[View the full topic](https://meta.discourse.org/t/certain-numerical-substrings-are-ignored/34207)._
