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

Interleaved search index incorrectly requires parent key in token_column_list #197

Open
silas opened this issue Dec 5, 2024 · 0 comments

Comments

@silas
Copy link

silas commented Dec 5, 2024

Interleaved search indexes incorrectly require the parent key in the token_column_list parameter.

CREATE TABLE one (
  one_id STRING(MAX) NOT NULL
)
PRIMARY KEY (one_id);

CREATE TABLE two (
  one_id       STRING(MAX) NOT NULL,
  two_id       STRING(MAX) NOT NULL,
  title        STRING(MAX),
  title_tokens TOKENLIST AS (TOKENIZE_SUBSTRING(title)) HIDDEN
)
PRIMARY KEY (one_id, two_id),
INTERLEAVE IN PARENT one;

Creating the valid search index fails:

CREATE SEARCH INDEX search_title ON two (title_tokens)
  PARTITION BY one_id,
  INTERLEAVE IN one
  OPTIONS (sort_order_sharding = true);

With the following error:

code = FailedPrecondition desc = Index search_title does not reference index parent key column one_id.

You can work around this in the emulator by adding the column, but this won't work in Google Cloud:

CREATE SEARCH INDEX search_title ON two (one_id, title_tokens)
  PARTITION BY one_id,
  INTERLEAVE IN one
  OPTIONS (sort_order_sharding = true);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant