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

model indexes error when values are removed #40639

Closed
dpsutton opened this issue Mar 26, 2024 · 0 comments · Fixed by #40642
Closed

model indexes error when values are removed #40639

dpsutton opened this issue Mar 26, 2024 · 0 comments · Fixed by #40642
Assignees
Labels
Misc/API Querying/Models aka Datasets Type:Bug Product defects
Milestone

Comments

@dpsutton
Copy link
Contributor

Describe the bug

Model indexes should surface records from models in search. When new values are present they should be indexed, and when values are no longer present they should no longer be in the index.

There's an issue when removing values from the index where we use the wrong column name in the update:

(when (seq deletions)
  (t2/delete! ModelIndexValue
              :model_index_id (:id model-index)
              :pk_ref [:in (->> deletions (map first))]))   ;; -> pk_ref is the column in model_index, not model_index_value

This yields values like:

select pk_ref, value_ref, state, error from model_index where state = 'error'

pk_ref,value_ref,state,error
"[""field"",563028,null]","[""field"",563018,null]",error,"ERROR: column ""pk_ref"" does not exist Position: 68"
"[""field"",534030,null]","[""field"",534037,null]",error,"ERROR: column ""pk_ref"" does not exist Position: 68"
"[""field"",545945,null]","[""field"",545948,null]",error,"ERROR: column ""pk_ref"" does not exist Position: 68"

To Reproduce

Index a model, have it not have values any longer, and then it errors trying to remove them.

Expected behavior

No response

Logs

No response

Information about your Metabase installation

master

Severity

p2 (possibly higher but fixing now)

Additional context

No response

@dpsutton dpsutton added Type:Bug Product defects Misc/API Querying/Models aka Datasets labels Mar 26, 2024
@dpsutton dpsutton self-assigned this Mar 26, 2024
@crisptrutski crisptrutski added this to the 0.49.2 milestone Mar 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Misc/API Querying/Models aka Datasets Type:Bug Product defects
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants