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

Fix EZP-23282: Solr returns wrong results after object language deletion #170

Merged
merged 1 commit into from Sep 15, 2014

Conversation

yannickroger
Copy link
Contributor

Link: https://jira.ez.no/browse/EZP-23282

Description

When deleting the translation of an object, the solr index is not updated.

Tests

Manual tests

foreach ( $languages as $language )
{
$languageCode = $language->attribute( 'locale' );
if ( $language instanceof eZContentLanguage )
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

said in phpdoc that languages will be an array of string, in which case can be a eZContentLanguage object?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see line 889

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wops. sorry then.

@crevillo
Copy link
Contributor

crevillo commented Sep 3, 2014

In general. Probably i'm missing something but looks weird to me that for a delete operation we're adding more logic to the addObject function.

I mean, isn't possible to modify deleteDocs function in order to pass deleted language there and so remove only the doc with the id + the language?

your pov @gggeek ?

Edit: Anyway, if i'm not wrong, if when deleting translation solr index is not updated, wouldn't you need to wait for a publish operation in order to make addObject works?

@yannickroger
Copy link
Contributor Author

Yes it looks weird to delete things in a method called addObject.
But this method also does updates and that is the use case we are interested in. When updating an object a solr /update query is generated and it updates the solr doc according to the object.

The situation is that an object can refer to several solr doc if you are using more than one language (1 solr doc per translation). So if you update an object whose translation has been removed, you need to delete a solr doc.

As @dpobel was telling me yesterday, it is important to keep in mind that: ezobject != solr doc

@crevillo
Copy link
Contributor

crevillo commented Sep 4, 2014

so, when a translation is deleted a "update object" is performed ?

So if you update an object whose translation has been removed, you need to delete a solr doc.

my point is we shouldn't wait for that update. it should be possible to trigger the update thing when the translation is removed...

Edit. Something similar to what is done when deleting an object. https://github.com/ezsystems/ezpublish-legacy/blob/master/kernel/classes/ezcontentobject.php#L1950

Wondering if we could just adding that logic to the deleteVersion operation and use the changes you add in removeObjectById...

@dpobel
Copy link
Contributor

dpobel commented Sep 5, 2014

+1

@andrerom
Copy link
Contributor

andrerom commented Sep 5, 2014

+0,5 ( review ping @paulborgermans )

@paulborgermans
Copy link
Contributor

I would also prefer to have the remove translation operation to call the modified removeObjectByID function in ezsolr.

@bdunogier
Copy link
Member

@paulborgermans I think we all would.

But preferences aside, do you see any risk with this approach ? I don't like this, but if it works (tm)...

@paulborgermans
Copy link
Contributor

@bdunogier no, there is no risk in this approach other than the few extra cpu cycles, so +1

yannickroger added a commit that referenced this pull request Sep 15, 2014
Fix EZP-23282: Solr returns wrong results after object language deletion
@yannickroger yannickroger merged commit e14fba7 into master Sep 15, 2014
@yannickroger yannickroger deleted the ezp-23282-delete_languages branch September 15, 2014 09:02
@yannickroger
Copy link
Contributor Author

I noticed a mistake while backporting, contentObject was passed in parameters instead of contentObjectId.

Fixed it in: 722313b

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