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

[4.0] Smart Search: Adding nested taxonomy #21327

Merged
merged 43 commits into from
Feb 28, 2019

Conversation

Hackwar
Copy link
Member

@Hackwar Hackwar commented Jul 31, 2018

Smart Search has a rather good taxonomy that allows to add a lot of additional filters for the search. However there are 2 flaws:

  • Nested taxonomies (like categories) are squashed into a flat list and
  • The state of a taxonomy is not updated in the search result.

This PR tries to fix both these flaws.

How does it work?

For legacy finder plugins, everything stays as it was, so we should be pretty much backwards compatible here. However new (or updated) plugins can use the new FinderIndexerResult::addNestedTaxonomy() method to add nested taxonomies. This method gets a node object as a parameter, which has to implement at least the ImmutableNodeInterface interface, that is introduced with this PR. Internally it iterates down the tree along its parents, adds each parent as a taxonomy node with the previous node as its parent. In the result object, we are now also storing the taxonomy ID so that we can lookup the right taxonomy again later. The taxonomy table has been changed to a nested set table.

How to test?

Apply these changes and make sure that the DB changes are applied, too. Then clear the index and re-run the indexing. You can then see the category filter in the frontend having a nested display, as well as in the backend. Check the taxonomy table in the DB for the nested entries, too.
Check if it properly filters for the respective taxonomies in the frontend when searching.
Enable displaying the taxonomies in the frontend and check that you can disable branches and single taxonomies and that those properly vanish from the filters and the result display. Create Search Filters in the backend and test those, too, if they properly honour the taxonomies.

Status of this PR

This PR is mostly working, but I'm not 100% confident that I caught all changes that are necessary. I think I'm now depending a bit on feedback from you.

@Hackwar Hackwar changed the title [4.0] Smart Search: Adding nested taxonomy (POC) [4.0] Smart Search: Adding nested taxonomy (WIP) Aug 2, 2018
@Hackwar Hackwar changed the title [4.0] Smart Search: Adding nested taxonomy (WIP) [4.0] Smart Search: Adding nested taxonomy Aug 2, 2018
…4finder_taxonomy

# Conflicts:
#	administrator/components/com_finder/tmpl/maps/default.php
…4finder_taxonomy

# Conflicts:
#	administrator/components/com_finder/Service/HTML/Filter.php
#	administrator/components/com_finder/Table/MapTable.php
#	administrator/components/com_finder/helpers/indexer/indexer.php
#	libraries/src/Tree/ImmutableNodeInterface.php
#	package-lock.json
@Hackwar
Copy link
Member Author

Hackwar commented Jan 9, 2019

Right now this depends on #23452 being merged first.

HLeithner and others added 4 commits February 17, 2019 21:33
Co-Authored-By: Hackwar <info@joomlager.de>
Co-Authored-By: Hackwar <info@joomlager.de>
Co-Authored-By: Hackwar <info@joomlager.de>
@HLeithner
Copy link
Member

On index or saving a article I get a fatal error:

Fatal error: Cannot use Joomla\CMS\Tree\NodeInterface as NodeInterface because the name is already in use in libraries/src/Categories/CategoryNode.php on line 18

@joomla-cms-bot joomla-cms-bot added the Language Change This is for Translators label Feb 19, 2019
Fixing language branch display
@Hackwar
Copy link
Member Author

Hackwar commented Feb 20, 2019

I've made all requested changes. Should be good to go. I can't see that the failing system test is related to this.

@wilsonge wilsonge merged commit f594a69 into joomla:4.0-dev Feb 28, 2019
@wilsonge
Copy link
Contributor

Looks like an improvement to me! Thanks!

@Hackwar
Copy link
Member Author

Hackwar commented Feb 28, 2019

💃 🍾 Thank you!

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

Successfully merging this pull request may close these issues.

5 participants