Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions skills/firebase-data-connect-basics/reference/search.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ SQL Connect. SQL Connect supports three types of search:

1. **Vector Similarity Search (Semantic)**: Best for finding
conceptually/semantically similar rows (e.g., recommendations, "more like
this"). Requires Vertex AI.
this"). Requires Gemini Enterprise Agent Platform.
1. **Full-Text Search (Lexical)**: Best for keyword and phrase search across
single or multiple columns. Supports lexical stemming.
1. **String Pattern Filters (Exact/Regex)**: Best for simple prefix, exact
Expand All @@ -21,7 +21,7 @@ task:
| Feature / Capability | Vector Similarity Search | Full-Text Search | String Pattern Filters |
| :------------------- | :-------------------------------------------------- | :--------------------------------------------- | :----------------------------------------------------- |
| **Use Case** | Semantic search, recommendations, RAG pipelines. | Keyword search, parsing large text fields. | Exact matches, regular expressions, simple wildcards. |
| **Engine Support** | Vertex AI Embeddings + `pgvector` extension. | Native PostgreSQL full-text engine. | Native PostgreSQL indexing (`LIKE`, `ILIKE`). |
| **Engine Support** | Agent Platform Embeddings + `pgvector` extension. | Native PostgreSQL full-text engine. | Native PostgreSQL indexing (`LIKE`, `ILIKE`). |
| **Matching Style** | Semantic/concept proximity. | Lexical stemming (tenses, root words). | Exact character sequence. |
| **Column Support** | Single column per query. | Multiple columns combined. | Multiple columns via standard logical filters (`_or`). |
| **Overhead** | High (API execution costs & vector column storage). | Medium (generates indices & tsvector columns). | Low (uses standard index / minimal storage). |
Expand All @@ -39,15 +39,15 @@ semantic meaning of text.
`@col(size: X)` directive — SQL Connect requires an explicit size for Vector
fields to allocate storage.
- **Match Model Specifications**: Ensure the column size matches the output
dimension of your chosen embedding model (e.g., **768** for Google Vertex AI's
`textembedding-gecko` models) to prevent runtime type mismatches.
dimension of your chosen embedding model (e.g., **768** for Google's

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.

medium

To maintain consistency with the rebranding of Vertex AI to Agent Platform (or Gemini Enterprise Agent Platform) throughout the document, consider updating "Google's" to "Agent Platform's" here.

Suggested change
dimension of your chosen embedding model (e.g., **768** for Google's
dimension of your chosen embedding model (e.g., **768** for Agent Platform's

`text-embedding-005` model) to prevent runtime type mismatches.

```graphql
type Movie @table {
id: UUID! @default(expr: "uuidV4()")
title: String!
description: String
# Vector field for description embeddings (Vertex AI gecko size is 768)
# Vector field for description embeddings (text-embedding-005 size is 768)
descriptionEmbedding: Vector! @col(size: 768)
}
```
Expand All @@ -70,7 +70,7 @@ mutation CreateMovieWithEmbedding($title: String!, $description: String!) @auth(
title: $title,
description: $description,
descriptionEmbedding_embed: {
model: "textembedding-gecko@003",
model: "text-embedding-005",
text: $description
}
})
Expand All @@ -87,7 +87,7 @@ mutation UpdateMovieDescription($id: UUID!, $description: String!) @auth(level:
data: {
description: $description,
descriptionEmbedding_embed: {
model: "textembedding-gecko@003",
model: "text-embedding-005",
text: $description
}
}
Expand All @@ -103,13 +103,13 @@ SQL Connect automatically generates a similarity query function for every
#### A. Auto-Embedding Search

Use `compare_embed` to automatically convert the search query string into an
embedding on the fly using Vertex AI.
embedding on the fly using Agent Platform.

```graphql
# connector/queries.gql
query SearchMoviesByDescription($query: String!) @auth(level: PUBLIC) {
movies_descriptionEmbedding_similarity(
compare_embed: { model: "textembedding-gecko@003", text: $query },
compare_embed: { model: "text-embedding-005", text: $query },
limit: 5
) {
id
Expand All @@ -122,7 +122,7 @@ query SearchMoviesByDescription($query: String!) @auth(level: PUBLIC) {
#### B. Custom Vector Search

Use `compare` to pass raw pre-computed float arrays (cast as a `Vector!`)
directly to the search without calling Vertex AI.
directly to the search without calling Agent Platform.

```graphql
# connector/queries.gql
Expand Down Expand Up @@ -151,7 +151,7 @@ query SearchMoviesByCustomVector($vector: Vector!, $limit: Int!) @auth(level: PU
# connector/queries.gql
query SearchMoviesCosineSimilarity($query: String!) @auth(level: PUBLIC) {
movies_descriptionEmbedding_similarity(
compare_embed: { model: "textembedding-gecko@003", text: $query },
compare_embed: { model: "text-embedding-005", text: $query },
method: COSINE,
within: 0.5, # Maximum distance threshold
limit: 5
Expand Down
Loading