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

EZP-25792: Deleted location don't affect subitems #46

Merged
merged 3 commits into from Jun 8, 2016

Conversation

2 participants
@galileo
Copy link
Contributor

commented May 25, 2016

Issue: https://jira.ez.no/browse/EZP-25792

Status: Ready for review
Depends on ezsystems/ezpublish-kernel#1658 (integration tests)

Explanation:

The problem is that when we delete location we also want to delete all related sub location with related content, but if there is a content that have still another existing location that is out of the delete location subtree we just need to reindex this location instead of delete it.

Solution:

The solution is to find first which location need to be reindexed and with then need to be deleted with the content. As solr is handling location that are within content block we need to reindex or delete content index data.

@galileo

This comment has been minimized.

Copy link
Contributor Author

commented May 25, 2016

I think I solved most issues for escaping and preparing query for deleted and update for solr documents.

So I have the good solr documnets in the solr engine but now when I use the second search just for an search for content with specific Id.


        $betterCriterion = new Criterion\ContentId(14);
        $betterQuery = new Query(array('filter' => $betterCriterion));

        $result = $searchService->findContent($betterQuery);

I recieve this kind of query:

(
  (
    document_type_id:content
  ) AND (
    (
      content_id:"14"
    ) AND (
      (
        section_id:"1"
      ) OR (
        (
          type_id:"25" 
          OR 
          type_id:"33"
        ) AND (
          section_id:"3"
        )
      )
    )
  ) AND (
    meta_indexed_is_main_translation_b:true
  )
)

Instead of this kind of query, used for the first search:


(
  (
    document_type_id:content
  ) AND (
    content_id:"14"
  ) AND (
    meta_indexed_is_main_translation_b:true
  )
)

So do anyone have any clues what is the reason? I just diagnosed it and any kind of information in this area will be very helpfull.

ping @pspanja

@galileo

This comment has been minimized.

Copy link
Contributor Author

commented May 30, 2016

I found what are those additional elements in my search query.

Because we are dealing there with users section we may destroy credentials if we touch this section, and I did this here.

So I will create new elements in the content area to be sure to test just the fixed behavior and not to deal with permssions.

Currently i have just this fixtures:

/1/2/ -> Home
/1/2/60/ -> Contact Us

What is the best approach to add here elements?

For now I will just write all creating stuff to test this case in this test but maybe some fixtures would be better?

ping @pspanja @andrerom

@galileo galileo force-pushed the galileo:EZP-25792-fix-index-sub-items branch 3 times, most recently from cd19d63 to 3e2b62d Jun 2, 2016

@andrerom

This comment has been minimized.

Copy link
Member

commented Jun 2, 2016

@galileo Not fully following the question, what did you have in mind here? What do you need to do? Are you asking how you can create content in integration tests?

@galileo

This comment has been minimized.

Copy link
Contributor Author

commented Jun 2, 2016

This question is actually related more to the publish-kernel because this is the place where our integration test lives.

I need to prepare a whole new structure of content with items and subitems and with additional location.
So I done this here straight in the code on the test begin:

https://github.com/ezsystems/ezpublish-kernel/pull/1658/files#diff-2a6b4eff68887cf7238f0c51cb2ab44cR183

I create a container with sub items and for one of them I add multiple locations.

So the main question now is, can this stay like this or is there any other way to do those fixtures?

@andrerom

@galileo galileo force-pushed the galileo:EZP-25792-fix-index-sub-items branch from 201b8fa to 0ae90b0 Jun 6, 2016

@galileo galileo force-pushed the galileo:EZP-25792-fix-index-sub-items branch from 0ae90b0 to f6062df Jun 6, 2016

@galileo

This comment has been minimized.

Copy link
Contributor Author

commented Jun 6, 2016

Why the final solution is different that the previous ?

Because when we need the _root_ id if we want to delete whole block in solr. I didn't found any useable alternative to remove block's, so the flow is now to find all those content that need to be deleted and then remove them by _root_ id.

Most risky places:

@andrerom @pspanja

@galileo galileo changed the title [WIP] EZP-25792: Deleted location don't affect subitems EZP-25792: Deleted location don't affect subitems Jun 6, 2016

}
return $result;
$queryString = $this->generateQueryString($parameters);

This comment has been minimized.

Copy link
@andrerom

andrerom Jun 6, 2016

Member

Seems like we can move this line into search() so we only need to pass parameters?

@@ -208,6 +208,8 @@ public function findLocations(LocationQuery $query, array $fieldFilters = array(
* @param string[] $fieldPaths
* @param int $limit
* @param \eZ\Publish\API\Repository\Values\Content\Query\Criterion $filter
*
* @throws \Exception

This comment has been minimized.

Copy link
@andrerom
@andrerom

This comment has been minimized.

Copy link
Member

commented Jun 8, 2016

+1

@andrerom andrerom merged commit ce42dc7 into ezsystems:master Jun 8, 2016

2 checks passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
ezrobot Code review by ezrobot
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.