Skip to content

Commit

Permalink
feat(psl): adjust "schema::can_full_text_search" via "Connector::nati…
Browse files Browse the repository at this point in the history
…ve_full_text_search_preview_feature"
  • Loading branch information
jkomyno committed Nov 26, 2024
1 parent 52b8ed7 commit ff64d52
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,11 @@ impl Connector for PostgresDatamodelConnector {
CAPABILITIES
}

/// The connector-specific name of the `fullTextSearch` preview feature.
fn native_full_text_search_preview_feature(&self) -> Option<PreviewFeature> {
Some(PreviewFeature::NativeFullTextSearchPostgres)
}

/// The maximum length of postgres identifiers, in bytes.
///
/// Reference: <https://www.postgresql.org/docs/12/limits.html>
Expand Down
5 changes: 5 additions & 0 deletions psl/psl-core/src/datamodel_connector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,11 @@ pub trait Connector: Send + Sync {
/// The static list of capabilities for the connector.
fn capabilities(&self) -> ConnectorCapabilities;

/// The connector-specific name of the `fullTextSearch` preview feature.
fn native_full_text_search_preview_feature(&self) -> Option<PreviewFeature> {
None
}

/// The maximum length of constraint names in bytes. Connectors without a
/// limit should return usize::MAX.
fn max_identifier_length(&self) -> usize;
Expand Down
7 changes: 5 additions & 2 deletions query-engine/schema/src/query_schema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,11 @@ impl QuerySchema {
}

pub(crate) fn can_full_text_search(&self) -> bool {
// TODO: add connector-specific `self.has_native_feature(ConnectorCapability::NativeFullTextSearch)` in conjunction with the next bool.
self.has_capability(ConnectorCapability::NativeFullTextSearch)
self.connector
.native_full_text_search_preview_feature()
.map(|feature| self.has_feature(feature))
.unwrap_or(true)
&& self.has_capability(ConnectorCapability::NativeFullTextSearch)
}

/// Returns whether the loaded connector supports the join strategy.
Expand Down

0 comments on commit ff64d52

Please sign in to comment.