Skip to content

Feature/search delete from index #581

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

Merged
merged 1 commit into from
Jan 12, 2015
Merged

Conversation

dantleech
Copy link
Contributor

Search deindexing on node delete and delete event from content mapper

  • Added loadShallowStructureForNode method to ContentMapper
  • Send out event for each deleted node and provide a Shallow structure to the listening events (in addition
    to the PHPCR node being deleted)

Tasks:

  • test coverage
  • gather feedback for my changes

Depends

Informations:

Q A
Tests pass? [yes
Fixed tickets fixes #578, fixes #271
BC Breaks NO
Doc NONE

@dantleech dantleech changed the title Feature/search delete from index [WIP] Feature/search delete from index Nov 19, 2014
Structure::NODE_TYPE_CONTENT
)
);
$structure->setWebspaceKey($webspaceKey);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I would really have loved to not have done this.

  • Structures should support lazy loading
  • I have repeated yet more logic here because the loadByNode stuff requires far more work than I can achieve in the scope of this feature.

Viva la revolution.

Copy link
Contributor

Choose a reason for hiding this comment

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

So you have basically duplicated this code? Why not put it into a separate function, and call it at the other place as well?

@dantleech dantleech changed the title [WIP] Feature/search delete from index Feature/search delete from index Nov 20, 2014
@alexander-schranz
Copy link
Member

@dantleech when will this be merged? I need the delete event for my project.
/cc @chirimoya

@wachterjohannes
Copy link
Member

@dantleech the tests are failing! could you take a look at this?

@dantleech
Copy link
Contributor Author

yeah. will do it this afternoon.

@dantleech dantleech force-pushed the feature/search-delete-from-index branch from c5aa185 to ceb44dd Compare December 15, 2014 15:16

Because they are applied otherwise add a permission value of 120 for
`sulu.security.roles`, `sulu.security.groups` and `sulu.security.users` to one
user to change the settings in the UI
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Lets not make upgrade instructions as bullet points.. we will need to give code examples sometimes and it just gets messy.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@dantleech dantleech force-pushed the feature/search-delete-from-index branch 2 times, most recently from 1cac3a3 to f49c4eb Compare December 16, 2014 12:41
@@ -56,4 +63,17 @@ public function onNodeSave(ContentNodeEvent $event)
$this->searchManager->deindex($structure);
}
}

public function onNodePreDelete(ContentNodeDeleteEvent $event)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Docs

@dantleech dantleech force-pushed the feature/search-delete-from-index branch from f49c4eb to b7d7cf2 Compare December 16, 2014 13:02
@dantleech
Copy link
Contributor Author

Tests are good. @wachterjohannes @alexander-schranz

@danrot
Copy link
Contributor

danrot commented Jan 7, 2015

What's the state of this PR?

@dantleech
Copy link
Contributor Author

was ready. needs a rebase.

@dantleech dantleech force-pushed the feature/search-delete-from-index branch from b7d7cf2 to b618bb9 Compare January 8, 2015 07:53
@dantleech
Copy link
Contributor Author

Hmm.. actually there are still a few things to tidy up


if ($structure->getNodeState() === Structure::STATE_PUBLISHED) {
$this->searchManager->index($structure);
} else {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

else is not required

@dantleech dantleech force-pushed the feature/search-delete-from-index branch from b618bb9 to 991e5b6 Compare January 8, 2015 08:30
@@ -24,9 +24,6 @@ class BaseTestCase extends SuluTestCase
public function setUp()
{
$this->initPhpcr();
$fs = new Filesystem;

$fs->remove(__DIR__ . '/../app/data');
Copy link
Contributor Author

Choose a reason for hiding this comment

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

why?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Seems fine without this.

Copy link
Contributor

Choose a reason for hiding this comment

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

Is really all data deleted after every run?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I delete before. It gives you the chance to debug, if you delete after you need to do things like die() to inspect the state of the database.

But tbh I am not sure why I removed this, I just noticed that it did no harm. Will verify.

@dantleech dantleech force-pushed the feature/search-delete-from-index branch from 991e5b6 to 9bfa3ee Compare January 8, 2015 08:37
@dantleech
Copy link
Contributor Author

Ready for review and merge.

@dantleech dantleech force-pushed the feature/search-delete-from-index branch from 9bfa3ee to d9c29b9 Compare January 8, 2015 08:38
@dantleech
Copy link
Contributor Author

SnippetBundle test failing.

@danrot
Copy link
Contributor

danrot commented Jan 12, 2015

Can you fix them?

@@ -2,6 +2,9 @@ CHANGELOG for Sulu
==================

* dev-develop
* FEATURE #581 [SearchBundle] Structures deindexed on delete
* FEATURE #581 [Content] NODE_SAVE renamed to NODE_POST_SAVE
Copy link
Contributor

Choose a reason for hiding this comment

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

Would write ContentBundle here, for the sake of consistency

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Its not ContentBundle though, its the Component.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Should align it though

@dantleech dantleech force-pushed the feature/search-delete-from-index branch 3 times, most recently from 1d8d0dc to d7b0c6d Compare January 12, 2015 10:43
@dantleech
Copy link
Contributor Author

@danrot updated

- Added NODE_DELETE event
- Renamed NODE_SAVE event to NODE_POST_SAVE
- SearchBundle deindexes on Structure delete
@dantleech dantleech force-pushed the feature/search-delete-from-index branch from d7b0c6d to 926027d Compare January 12, 2015 14:36
@danrot danrot merged commit 926027d into develop Jan 12, 2015
@danrot danrot removed the review label Jan 12, 2015
@danrot danrot deleted the feature/search-delete-from-index branch January 12, 2015 14:40
alexander-schranz pushed a commit to alexander-schranz/sulu that referenced this pull request Nov 14, 2024
* Adjust documentation to configure live-generation of URL

* Add section about template specific route schema
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

Successfully merging this pull request may close these issues.

[SuluBundle] Handle node delete and deindexation Rename NODE_SAVE event to NODE_POST_SAVE
4 participants