Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add match operator in ColumnExpression for FTS5. #1038

Merged
merged 4 commits into from
Aug 22, 2021

Conversation

GetToSet
Copy link
Sponsor Contributor

Pull Request Checklist

  • This pull request is submitted against the development branch.
  • Inline documentation has been updated.
  • README.md or another dedicated guide has been updated.
  • Changes are tested.

I'm using GRDB.swift with FTS5 support in my own project and found that in FTS5 query interface, there is no match operator for column expressions, which is found in FTS3.

This PR add this operator expression and related tests, making it aligned with FTS3 query interface API.

@groue
Copy link
Owner

groue commented Aug 22, 2021

Thank you @GetToSet, FTS5 column filters were lacking 👍

@groue
Copy link
Owner

groue commented Aug 22, 2021

I removed the support for column.match(nil), since SQLite throws a syntax error for MATCH NULL.

I also updated the documentation.

@groue groue merged commit c7294af into groue:development Aug 22, 2021
@GetToSet
Copy link
Sponsor Contributor Author

I removed the support for column.match(nil), since SQLite throws a syntax error for MATCH NULL.

I also updated the documentation.

column.match(nil) also presents in FTS3 (FTS3+QueryInterface.swift), should it also be disabled?

@groue
Copy link
Owner

groue commented Aug 22, 2021

No, because FTS3 accepts NULL. A little harmless SQLite inconsistency ;-)

@GetToSet
Copy link
Sponsor Contributor Author

GetToSet commented Aug 22, 2021

No, because FTS3 accepts NULL. An little harmless SQLite inconsistency ;-)

🤔 I've never dived such detailed into SQLite grammar, BTW, thanks for instant response for this PR.

@groue
Copy link
Owner

groue commented Aug 22, 2021

I just ran the tests, and saw that nil matching was throwing an error.

Since you are contributing many FTS5 enhancements to GRDB, please let me share a tip. When you open the GRDB workspace, you can run tests with FTS5 enabled by modifying GRDBDeploymentTarget.xcconfig:

// Add this line to GRDBDeploymentTarget.xcconfig
OTHER_SWIFT_FLAGS = $(inherited) -D SQLITE_ENABLE_FTS5

You can then select the GRDBOSX schema, and run FTS5 tests.

Do not commit this change! The raw project must remain FTS5-free so can users can embed it in their apps that target older operating systems.

@groue
Copy link
Owner

groue commented Aug 22, 2021

Shipped in v5.10.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants