Skip to content

Add TSVECTOR and match operator (@@) for PostgreSQL - #10956

Closed
janokacer wants to merge 3 commits into
sequelize:masterfrom
VESTBERRY:master
Closed

janokacer wants to merge 3 commits into
sequelize:masterfrom
VESTBERRY:master

Conversation

@janokacer

@janokacer janokacer commented May 15, 2019 •

Copy link
Copy Markdown

Pull Request check-list

Please make sure to review and check all of these items:

  • Does npm run test or npm run test-DIALECT pass with this change (including linting)?
  • Does the description below contain a link to an existing issue (Closes #[issue]) or a description of the issue you are solving?
  • Have you added new tests to prevent regressions?
  • Is a documentation update included (if this change modifies existing APIs, or introduces new ones)?
  • Did you follow the commit message conventions explained in CONTRIBUTING.md?

Description of change

Added TSVECTOR datatype and @@ operator for postgresql more information about datatype here:
https://www.postgresql.org/docs/current/functions-textsearch.html

Closes #1580

@SimonSchick SimonSchick left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs test

@jnelken

jnelken commented May 26, 2019

Copy link
Copy Markdown

Here is the fulltext issue related to this PR #1580

@codecov

codecov Bot commented May 31, 2019 •

Copy link
Copy Markdown

Codecov Report

Merging #10956 into master will increase coverage by 3.78%.
The diff coverage is 50%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #10956      +/-   ##
==========================================
+ Coverage   92.47%   96.25%   +3.78%     
==========================================
  Files          91       94       +3     
  Lines        8903     9192     +289     
==========================================
+ Hits         8233     8848     +615     
+ Misses        670      344     -326
Impacted Files Coverage Δ
lib/dialects/abstract/query-generator/operators.js 90.9% <ø> (ø) ⬆️
lib/dialects/postgres/index.js 100% <ø> (ø) ⬆️
lib/operators.js 100% <ø> (ø) ⬆️
lib/data-types.js 91.03% <0%> (+0.03%) ⬆️
lib/dialects/postgres/data-types.js 96.27% <100%> (+0.01%) ⬆️
lib/dialects/sqlite/index.js 100% <0%> (ø)
lib/dialects/sqlite/query.js 98.65% <0%> (ø)
lib/dialects/sqlite/connection-manager.js 100% <0%> (ø)
lib/dialects/abstract/query-generator.js 97.01% <0%> (+0.51%) ⬆️
... and 8 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 21d743a...db27d32. Read the comment docs.

Comment thread docs/models-usage.md Resolved
@papb papb added dialect: postgres For issues and PRs. Things that involve PostgreSQL (and do not involve all dialects). status: awaiting approval type: feature DEPRECATED: replace with the "feature" issue type labels Jul 26, 2019
@papb

papb commented Oct 30, 2019

Copy link
Copy Markdown
Member

@janokacer Hello, this PR has conflicts, can you please rebase?

@papb papb added status: awaiting response For issues and PRs. OP must respond (or change something, if it is a PR). Maintainers have no action and removed status: awaiting maintainer labels Oct 30, 2019
@janokacer

Copy link
Copy Markdown
Author

@janokacer Hello, this PR has conflicts, can you please rebase?

Hello @papb, I just did. I hope it helps.

@papb

papb commented Oct 31, 2019

Copy link
Copy Markdown
Member

Fantastic, thank you very much. I will review now

@papb
papb dismissed SimonSchick’s stale review October 31, 2019 16:55

Dismissing as outdated

@papb papb left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You have added a unit test for it, which is great, but I would like to see an integration test as well. Please add one to the end of the data types integration test file, surround the test with an if checking for dialect support, such as the following:

if (current.dialect.supports.RANGE) {

On the integration test, define a model that uses this new datatype and make some queries confirming that it works correctly.

Also, please add a typings test to prevent regressions on your TS changes.

Comment thread lib/data-types.js
Comment on lines +944 to +946
validate() {
return true;
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about a better validation like this one?

sequelize/lib/data-types.js

Lines 129 to 134 in db27d32

validate(value) {
if (typeof value !== 'string') {
throw new sequelizeErrors.ValidationError(util.format('%j is not a valid string', value));
}
return true;
}

@papb

papb commented Jan 15, 2020

Copy link
Copy Markdown
Member

Hello, anyone that is reading this, would be willing to continue the work on this PR? You can fork OP's fork and continue from there. Thanks!

@cauefernandes

Copy link
Copy Markdown

@papb what's the issue here preventing merge?

@oktapodia oktapodia mentioned this pull request Aug 20, 2020
2 of 6 tasks
@djake

djake commented Jan 15, 2021 •

Copy link
Copy Markdown

I am currently writing the SQL by hand due to lack of support for the match operator, which stinks because I lose all the Sequelize goodness.

@cauefernandes (or anyone else) are you planning on bringing this to completion soon? If not I'm more than happy to do so.

Edit: Just noticed the date, so I assume not, but LMK!

@djake

djake commented Jan 15, 2021

Copy link
Copy Markdown

Closing this in favor of #12631 which has an integration test a fewer conflicts. Thank you for this.

@djake djake closed this Jan 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dialect: postgres For issues and PRs. Things that involve PostgreSQL (and do not involve all dialects). status: awaiting response For issues and PRs. OP must respond (or change something, if it is a PR). Maintainers have no action type: feature DEPRECATED: replace with the "feature" issue type

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fulltext support

8 participants