pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Laurenz Albe <laurenz.albe@cybertec.at>
To: pperalta@gmail.com
To: pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #18149: Incorrect lexeme for english token "proxy"
Date: Sat, 07 Oct 2023 14:49:21 +0200
Message-ID: <25d0bf34e0f7e0d9f3455e1b7adaf5a5aee810e1.camel@cybertec.at> (raw)
In-Reply-To: <18149-936d14e6fc76ca61@postgresql.org>
References: <18149-936d14e6fc76ca61@postgresql.org>

On Thu, 2023-10-05 at 21:44 +0000, PG Bug reporting form wrote:
> The english dictionary is using the lexeme "proxi" for the token "proxy". As
> a result, the search term "proxy" is not yielding results for records that
> contain this word.
> 
> # select * from ts_debug('english', 'proxy');
>    alias   |   description   | token |  dictionaries  |  dictionary  |
> lexemes
> -----------+-----------------+-------+----------------+--------------+---------
>  asciiword | Word, all ASCII | proxy | {english_stem} | english_stem |
> {proxi}

I cannot reproduce that.  If I generate a text search query for "proxy",
I get this:

SELECT to_tsquery('english', 'proxy');

 to_tsquery 
════════════
 'proxi'
(1 row)

which will work just fine.

> I think this lexeme was chosen to support the plural of proxy which is
> proxies. However there are other plurals where the root word is spelled
> different and Postgres creates the correct lexeme such as: [goose or mouse]

The snowball dictionary has no real knowledge of the words.  Stemming is
done by applying some heuristics which work "well enough" in most cases.
In the case of "proxy", the rule seems simply to be to stem everything that
ends in "y" as ending in "i", in the hope to catch plurals that are built
along the same lines as for "proxy":

select * from to_tsvector('english', 'mumply');

 to_tsvector 
═════════════
 'mumpli':1
(1 row)

This works fine in most cases, but every heuristic can go wrong occasionally:

select * from to_tsvector('english', 'standby');

 to_tsvector 
═════════════
 'standbi':1
(1 row)

Yours,
Laurenz Albe





view thread (6+ messages)  latest in thread

Message-ID: <25d0bf34e0f7e0d9f3455e1b7adaf5a5aee810e1.camel@cybertec.at>
Permalink:  ../25d0bf34e0f7e0d9f3455e1b7adaf5a5aee810e1.camel@cybertec.at/
Also on:    postgresql.org/message-id/25d0bf34e0f7e0d9f3455e1b7adaf5a5aee810e1.camel@cybertec.at

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: laurenz.albe@cybertec.at, pperalta@gmail.com
  Subject: Re: BUG #18149: Incorrect lexeme for english token "proxy"
  In-Reply-To: <25d0bf34e0f7e0d9f3455e1b7adaf5a5aee810e1.camel@cybertec.at>
  References: <18149-936d14e6fc76ca61@postgresql.org> <25d0bf34e0f7e0d9f3455e1b7adaf5a5aee810e1.camel@cybertec.at>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox