# Add search synonyms

**URL:** https://meta.discourse.org/t/add-search-synonyms/142050
**Category:** Feature
**Created:** [February 19, 2020, 8:36pm UTC](https://meta.discourse.org/t/add-search-synonyms/142050 "2020-02-19T20:36:34Z")
**Posts on this page:** 18
**Page:** 1

<div class="post-metadata">

### Author: ![DaleKramer](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/dalekramer/32/169487_2.png) [@DaleKramer](https://meta.discourse.org/u/DaleKramer)
#### Post date: [February 19, 2020, 8:36pm UTC](https://meta.discourse.org/t/add-search-synonyms/142050/1 "2020-02-19T20:36:34Z")

</div>

I have been reading a lot here lately and see that ‘post’ and ‘reply’ seem to be used somewhat interchangeably.

If this were done, it would result in fewer bothersome questions when someone uses the wrong one of the two for their searching before they ask a question with a new topic (LOL it just happened to me, ‘delete post after’ did not produce the same results as ‘delete reply after’…)

Hence my topic question…

---

<div class="post-metadata">

### Author: ![jomaxro](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jomaxro/32/126216_2.png) [@jomaxro](https://meta.discourse.org/u/jomaxro)
#### Post date: [February 19, 2020, 8:45pm UTC](https://meta.discourse.org/t/add-search-synonyms/142050/2 "2020-02-19T20:45:46Z")

</div>

Reply and post are not 100% interchangeable. In most usage we see here on Meta they are, but not always.

I’d suggest reviewing [Understanding Discourse for new users](https://meta.discourse.org/t/discourse-new-user-guide/96331#heading--terms), which describes what a post is. A reply is any post that is not the OP.

---

<div class="post-metadata">

### Author: ![DaleKramer](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/dalekramer/32/169487_2.png) [@DaleKramer](https://meta.discourse.org/u/DaleKramer)
#### Post date: [February 19, 2020, 8:51pm UTC](https://meta.discourse.org/t/add-search-synonyms/142050/3 "2020-02-19T20:51:57Z")

</div>

But I would rather find what I am searching for even if I do not know the correct terminology.

For those more ‘in the know’, would they not still have the option of doing explicit searches with quotes around their explicit term of interest, for example “reply” ❓

---

<div class="post-metadata">

### Author: ![DaleKramer](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/dalekramer/32/169487_2.png) [@DaleKramer](https://meta.discourse.org/u/DaleKramer)
#### Post date: [February 19, 2020, 8:55pm UTC](https://meta.discourse.org/t/add-search-synonyms/142050/4 "2020-02-19T20:55:13Z")

</div>

> [@jomaxro](#):
>
> I’d suggest reviewing [Discourse New User Guide](https://meta.discourse.org/t/discourse-new-user-guide/96331#heading--terms), which describes what a post is. A reply is any post that is not the OP.

Thanks, I will read that but do many other people read that before they make new topics here?

---

<div class="post-metadata">

### Author: ![DaleKramer](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/dalekramer/32/169487_2.png) [@DaleKramer](https://meta.discourse.org/u/DaleKramer)
#### Post date: [February 19, 2020, 9:18pm UTC](https://meta.discourse.org/t/add-search-synonyms/142050/5 "2020-02-19T21:18:50Z")

</div>

> [@jomaxro](#):
>
> A reply is any post that is not the OP.

So, I read the ‘Discourse New User Guide’ and I am unable to find any explicit definition of ‘reply’.

But as I have quoted you above, a ‘reply’ is necessarily a ‘post’, so when someone searches for ‘post’ all ‘reply’ matches should also be presented…

Whether, a search for ‘reply’ should bring up all ‘post’ entries is also unknown after reading that guide.

So, I would still like to have the request of this topics’ title, acted upon. (but again, that is only my opinion)

---

<div class="post-metadata">

### Author: ![Remah](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/remah/32/70590_2.png) [@Remah](https://meta.discourse.org/u/Remah)
#### Post date: [February 19, 2020, 9:25pm UTC](https://meta.discourse.org/t/add-search-synonyms/142050/6 "2020-02-19T21:25:13Z")

</div>

> [@DaleKramer](#):
>
> a ‘reply’ is necessarily a ‘post’, so when someone searches for ‘post’ all ‘reply’ matches should also be presented…

A reply is necessarily a post but some posts are not replies so searching on post should not automatically add the reply search term.

If your preference is satisfied then it will annoy other users like myself who are only searching for post and not reply.

---

<div class="post-metadata">

### Author: ![DaleKramer](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/dalekramer/32/169487_2.png) [@DaleKramer](https://meta.discourse.org/u/DaleKramer)
#### Post date: [February 19, 2020, 9:28pm UTC](https://meta.discourse.org/t/add-search-synonyms/142050/7 "2020-02-19T21:28:15Z")

</div>

But you are obviously ‘in the know’ and would likely just use an explicit search term without bothering people here with a new topic about why so many search results for ‘post’ are showing up in your ‘reply’ searches.

---

<div class="post-metadata">

### Author: ![awesomerobot](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/awesomerobot/32/142900_2.png) [@awesomerobot](https://meta.discourse.org/u/awesomerobot)
#### Post date: [February 19, 2020, 9:30pm UTC](https://meta.discourse.org/t/add-search-synonyms/142050/8 "2020-02-19T21:30:09Z")

</div>

Regardless of the semantics of post/reply — adding synonyms to search isn’t something that can be configured in Discourse at the moment.

---

<div class="post-metadata">

### Author: ![DaleKramer](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/dalekramer/32/169487_2.png) [@DaleKramer](https://meta.discourse.org/u/DaleKramer)
#### Post date: [February 19, 2020, 9:34pm UTC](https://meta.discourse.org/t/add-search-synonyms/142050/9 "2020-02-19T21:34:38Z")

</div>

Ok, that shuts me up 😉 but perhaps there should be a way to add them, I predict it could lessen the burden on the good people who respond to newbies on this great forum 🙂

---

<div class="post-metadata">

### Author: ![Remah](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/remah/32/70590_2.png) [@Remah](https://meta.discourse.org/u/Remah)
#### Post date: [February 20, 2020, 12:10am UTC](https://meta.discourse.org/t/add-search-synonyms/142050/10 "2020-02-20T00:10:20Z")

</div>

Actually, I do general searches and then follow relevant links that have some overlap with what I’m searching for.

Search engines have an idea of which links are followed. Discourse has something similar. “Suggested messages” at the end of the topic are a fruitful source of relevant topics not directly related to the specific search terms.

---

<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: [February 20, 2020, 3:21am UTC](https://meta.discourse.org/t/add-search-synonyms/142050/11 "2020-02-20T03:21:32Z")

</div>

I am recategorizing it as #Contribute > Feature the feature request is pretty clear to me. It is asking for a place in the UX to define custom synonyms.

Postgres technically supports synonyms per:

> **[Paris paris - 12.6. Dictionaries](https://www.postgresql.org/docs/current/textsearch-dictionaries.html#TEXTSEARCH-SYNONYM-DICTIONARY)**
>
> Dictionaries are used to eliminate words that should not be considered in a search (stop words), and to normalize words so that different derived forms of the same word will match. A successfully normalized word is called a lexeme. Aside from...

So if you wanted to get your gloves off and be mega technical you could wire something today, but I agree that some time in the future adding a UI to allow mods to define this may be interesting.

Not putting a #pr-welcome on this cause it is complicated and would take quite a while to get right with possible limited benefit.

Timeframe wise I would say this is something I expect not to get to in the next year and probably to get to within the next 5 years.

---

<div class="post-metadata">

### Author: ![anon48433008](https://avatars.discourse-cdn.com/v4/letter/a/22d042/32.png) [@anon48433008](https://meta.discourse.org/u/anon48433008)
#### Post date: [February 20, 2020, 11:15am UTC](https://meta.discourse.org/t/add-search-synonyms/142050/12 "2020-02-20T11:15:40Z")

</div>

Congratulations Dale 🥳

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

---

<div class="post-metadata">

### Author: ![scott.robinson](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/scott.robinson/32/249225_2.png) [@scott.robinson](https://meta.discourse.org/u/scott.robinson)
#### Post date: [April 27, 2023, 2:33pm UTC](https://meta.discourse.org/t/add-search-synonyms/142050/14 "2023-04-27T14:33:59Z")

</div>

We’ve made an update to our terminology (User is now “Member”) and we’ve updated our documentation accordingly, but I’d like to be able to have anyone who searches for User to automatically see the results mentioning “Member”. Any thoughts on an easy method to accomplish this?

CC: @michellefs

---

<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: [May 8, 2023, 4:06am UTC](https://meta.discourse.org/t/add-search-synonyms/142050/15 "2023-05-08T04:06:33Z")

</div>

It is a reasonably hard one, we could potentially build a plugin that injects synonyms to the indexed data - but we would be talking anything between 1 day to 5 days of work

I guess the big question here is how important is this to you? It is doable but would require some custom consulting on our part.

---

<div class="post-metadata">

### Author: ![Jagster](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jagster/32/192154_2.png) [@Jagster](https://meta.discourse.org/u/Jagster)
#### Post date: [May 8, 2023, 6:49am UTC](https://meta.discourse.org/t/add-search-synonyms/142050/16 "2023-05-08T06:49:56Z")

</div>

> [@scott.robinson](#):
>
> automatically see the results mentioning “Member”

I don’t know anything but isn’t that just matter of changing texts from customize side? Or do I now, as usual, understanding totally wrong?

---

<div class="post-metadata">

### Author: ![michellefs](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/michellefs/32/234543_2.png) [@michellefs](https://meta.discourse.org/u/michellefs)
#### Post date: [May 10, 2023, 5:38pm UTC](https://meta.discourse.org/t/add-search-synonyms/142050/17 "2023-05-10T17:38:07Z")

</div>

I think the hope is to have the ability to impact the search algorithm indirectly through a tool like [tag synonyms](https://meta.discourse.org/t/merging-tags-tag-synonyms/81869/16). But for any keywords within a post (or the original post, at least).

An example of a use case would be for community members/site visitors who search for their colloquial phrases rather than similar brand jargon. The search algorithm prioritized very different topics. An example on our site would be searching for “desktop app” versus “native client” topics.

Curious whether viewpoints on typos have changed over the years:

> [@Can I add hidden metadata like word synonyms to topics to make them easier to find?](https://meta.discourse.org/t/can-i-add-hidden-metadata-like-word-synonyms-to-topics-to-make-them-easier-to-find/192834/4):
>
> This is generally what tags are for, and tags have synonyms. You could make the same argument about spelling errors – that a search for “guidence” should match “guidance”. It takes some very fancy search engine work for this to be possible, though. Right now we rely on the built in search capability of the Postgres database engine. In reality, I think the best solution is curation – to have a staff member, or a TL4 user, edit in all the necessary terms to generate a good search match in the bo…

---

<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: [May 31, 2023, 1:15am UTC](https://meta.discourse.org/t/add-search-synonyms/142050/18 "2023-05-31T01:15:32Z")

</div>

> [@michellefs](#):
>
> Curious whether viewpoints on typos have changed over the years:

In Discourse-AI we started experimenting with semantic search. This is still early days and we are still exploring these systems.

 ![image](https://global.discourse-cdn.com/meta/original/4X/2/4/b/24b49ead4cff0a30606fa33e96a20a393c3d177f.png)

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

Using LLMs to improve the search prompt is also a possible (albeit slow today) approach:

 ![image](https://global.discourse-cdn.com/meta/original/4X/4/1/2/412805eda857ec58fdc95f00243f0a183042c4c2.png)

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

This technique is mentioned here: [GitHub - texttron/hyde: HyDE: Precise Zero-Shot Dense Retrieval without Relevance Labels · GitHub](https://github.com/texttron/hyde)

* * *

Besides the 100% automated approaches

Our general strategy here is to iterate. We already have “watched words” in the product, I would not mind a feature that adds “Search Synonyms” where you specify common typos and common phrases you wish to “stuff”. It is not scheduled work but certainly something you could look at sponsoring.

There is precedence for this exact feature in Postgres per: [PostgreSQL: Documentation: 18: 12.6.&nbsp;Dictionaries](https://www.postgresql.org/docs/current/textsearch-dictionaries.html#TEXTSEARCH-SYNONYM-DICTIONARY)

The other area I am open to exploring (I am only lukewarm though on this) is allowing for a hidden “metadata” place on posts, where admins can stuff search terms. It is very very invisible and generally I recommend just “properly” stuffing the works so stuff is not hidden eg:

> **SEO**
>
> semantic, related, improving

---

<div class="post-metadata">

### Author: ![Falco](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/falco/32/179432_2.png) [@Falco](https://meta.discourse.org/u/Falco)
#### Post date: [June 1, 2023, 12:48am UTC](https://meta.discourse.org/t/add-search-synonyms/142050/20 "2023-06-01T00:48:20Z")

</div>

> [@sam](#):
>
> This technique is mentioned here: [GitHub - texttron/hyde: HyDE: Precise Zero-Shot Dense Retrieval without Relevance Labels](https://github.com/texttron/hyde)

![Shocked Cosmo Kramer GIF](https://global.discourse-cdn.com/meta/original/4X/2/2/0/22056b916db5af6ac3288cdaa5805d644ec8f396.webp)

That is a pure genius idea, it solves the main problem of the embeddings based search: bad user input.

And it requires minimal changes from our existing setup, as you only need to add a small step “enriching” the search query 🤯

* * *

On this topic, something that we can also do is doing a hybrid search:

- Search using existing PG full text search
- Search using embeddings
- Gather both best 50 results
- Pass to a search re-ranker service
- Show the re-ranked results

We already ship a super capable re-ranked in our existing embeddings API under a separate endpoint, this has all the necessary pieces ready to happen.

Example here:

[https://github.com/pgvector/pgvector-python/blob/master/examples/hybrid\_search.py#L67-L70](https://github.com/pgvector/pgvector-python/blob/master/examples/hybrid_search.py#L67-L70)
