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

Updating RT indexes with only the dirty attributes causes existing fields/attributes to disappear. #83

Closed
benlees opened this issue Oct 12, 2017 · 2 comments
Assignees
Labels
Milestone

Comments

@benlees
Copy link

benlees commented Oct 12, 2017

What steps will reproduce the problem?

Update some of the fields/attributes in an existing RT index (containing a combination of attr_bigint, field, string, timestamp and bool). As only dirty attributes are updated, Sphinx will zero out some of the bigint, field, timestamp attributes causing data loss.

What's expected?

Attributes that aren't updated should remain untouched.

What do you get instead?

The attributes are lost and valued as 0 (in case of ints/timestamps, and empty string for a field string).

Additional info

Changing function updateInternal in yii2-sphinx\ActiveRecord.php from:
$values = $this->getDirtyAttributes();
to
$values = $this->getAttributes();
resolves the issue.

Q A
Yii version 2.0.12
Yii Sphinx version 2.0.8.0
Sphinx server version SphinxSearch-2.2.11-id64-release (95ae9a6)
PHP version 7.0.10
Operating system Windows 7
@klimov-paul klimov-paul added the status:to be verified Needs to be reproduced and validated. label Oct 12, 2017
@klimov-paul klimov-paul self-assigned this Oct 12, 2017
@klimov-paul klimov-paul added type:bug Bug and removed status:to be verified Needs to be reproduced and validated. labels Oct 12, 2017
@klimov-paul klimov-paul added this to the 2.0.9 milestone Oct 12, 2017
@klimov-paul
Copy link
Member

Resolved by commit 4668e6a

@benlees
Copy link
Author

benlees commented Oct 12, 2017

Cheers!

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

No branches or pull requests

2 participants