# Search function returning approximate results?

**URL:** https://meta.discourse.org/t/search-function-returning-approximate-results/209536
**Category:** Bug
**Created:** [November 18, 2021, 2:41pm UTC](https://meta.discourse.org/t/search-function-returning-approximate-results/209536 "2021-11-18T14:41:05Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![Canapin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/canapin/32/119591_2.png) [@Canapin](https://meta.discourse.org/u/Canapin)
#### Post date: [November 18, 2021, 2:41pm UTC](https://meta.discourse.org/t/search-function-returning-approximate-results/209536/1 "2021-11-18T14:41:05Z")

</div>

Hi.

I was searching for this topic on my forum: [les passants - Autour d'une roue - Monocycle.info](https://forum.monocycle.info/t/les-passants/318)

The topic’s title is “les passants”

Before, searching with “passants in:title” would return this topic among the first results.

But now, it displays approximate results:

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

Instead of “passants”, you’ll see “passe”, “pass”, “passage”, “passion”, some of these words before even the exact string “passants”…

I suppose this is a bug?

---

<div class="post-metadata">

### Author: ![JammyDodger](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jammydodger/32/254611_2.png) [@JammyDodger](https://meta.discourse.org/u/JammyDodger)
#### Post date: [November 18, 2021, 5:51pm UTC](https://meta.discourse.org/t/search-function-returning-approximate-results/209536/2 "2021-11-18T17:51:41Z")

</div>

I’m afraid I don’t know enough about the Search to know if that’s on purpose or not, but you can add double quotes around a word to make it an exact search if that helps?

Eg. `"passants"`

[Résultats de recherche pour «&nbsp;"passants" in:title&nbsp;» - Monocycle.info](https://forum.monocycle.info/search?q=%22passants%22%20in%3Atitle)

---

<div class="post-metadata">

### Author: ![Canapin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/canapin/32/119591_2.png) [@Canapin](https://meta.discourse.org/u/Canapin)
#### Post date: [November 19, 2021, 12:28am UTC](https://meta.discourse.org/t/search-function-returning-approximate-results/209536/3 "2021-11-19T00:28:12Z")

</div>

That sure helps, but the default behavior is puzzling.

For an unknown reason, when searching the exact string with double quotes, it also returns a result that has no “passants” in the title (but it has in the first post content):

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

> **[Résultats de recherche pour « "passants" in:title » - Monocycle.info](https://forum.monocycle.info/search?q=%22passants%22%20in%3Atitle)**
>
> Bienvenue dans la plus grande communauté du monocycle francophone. Discussions, questions, conseils, petites annonces… Rejoignez-nous ! 👍

---

<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: [November 19, 2021, 12:57am UTC](https://meta.discourse.org/t/search-function-returning-approximate-results/209536/4 "2021-11-19T00:57:18Z")

</div>

> [@Canapin](#):
>
> Au lieu de « passants », vous verrez « passe », « pass », « passage », « passion », certains de ces mots avant même la chaîne exacte « passants »…
> 
> Je suppose que c’est un bug ?

En français, `passants` est réduit au lexème `pass` avant que nous ne recherchions dans le contenu des publications.

> Un lexème est une chaîne, tout comme un jeton, mais il a été _normalisé_ de sorte que différentes formes du même mot soient rendues identiques.

---

<div class="post-metadata">

### Author: ![Canapin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/canapin/32/119591_2.png) [@Canapin](https://meta.discourse.org/u/Canapin)
#### Post date: [November 19, 2021, 10:55am UTC](https://meta.discourse.org/t/search-function-returning-approximate-results/209536/5 "2021-11-19T10:55:18Z")

</div>

I understand.

Are the lexemes language-related?

I don’t feel it makes much sense in French to reduce such a word to “pass”. 🤔 This is more confusing than helping considering there are a lot of words that begin with “pass” without being (directly or not) related to the verb “passer”.

But if we can target the exact string with double quotes instead, that will do 🙂.

Also, what’s with the second result not having “passants” in the title despite using the double quotes on my last screenshot?

---

<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: [November 22, 2021, 1:17am UTC](https://meta.discourse.org/t/search-function-returning-approximate-results/209536/6 "2021-11-22T01:17:24Z")

</div>

> [@Canapin](#):
>
> Are the lexemes language-related?

This stuff is configurable in Postgres, but the French implementation in Postgres is the thing reducing this all the way down:

```plaintext
discourse_development=# select to_tsvector('french', 'passants');
 to_tsvector
-------------
 'pass':1
(1 row)

discourse_development=# select to_tsvector('english', 'passants');
 to_tsvector
-------------
 'passant':1
(1 row)

```

There are more fancy dictionaries that can be used, but they are extremely complicated to configure.
