npgsql / npgsql

Npgsql is the .NET data provider for PostgreSQL.
http://www.npgsql.org
PostgreSQL License
3.28k stars 822 forks source link

Obsolete full-text-search client-side parsing #4946

Closed roji closed 10 months ago

roji commented 1 year ago

We received a user complaint about NpgsqlTsVector.Parse not accepting a configuration argument; that function mimics the PG to_tsvector, which parses a text into a tsvector, optionally given a configuration ("language").

Unless I'm mistaken, this is another case of old Npgsql code which attempts to duplicate complex PostgreSQL functionality, although it's not possible to do so. PG's to_tsvector consults language-specific dictionaries to normalize lexemes (e.g. plural->singular), which is something that Npgsql can never do. For example, SELECT to_tsvector('rats') returns rat (normalized to singular), whereas NpgsqlTsVector.Parse("rats") returns rats.

payoff commented 1 year ago

I agree that this code should be removed. The behavior of the client should not be to replicate the server's activities, but rather to utilize them.

For example, SELECT to_tsvector('rats') returns rat (normalized to singular), whereas NpgsqlTsVector.Parse("rats") returns rats.

Furthermore, the implementation is partial and incorrect, as evidenced.