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

Projects
None yet
5 participants
@Hackwar
Copy link
Member

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 added some commits Jun 16, 2018

Merge branch '4.0-dev' of https://github.com/joomla/joomla-cms into j…
…4finder_commonwords

# Conflicts:
#	installation/sql/mysql/joomla.sql
#	installation/sql/postgresql/joomla.sql
Merge branch '4.0-dev' of https://github.com/joomla/joomla-cms into j…
…4finder_commonwords

# Conflicts:
#	installation/sql/mysql/joomla.sql
#	installation/sql/postgresql/joomla.sql

Hackwar added some commits Jul 31, 2018

@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 added some commits 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

Hackwar added some commits Sep 21, 2018

Merge branch '4.0-dev' of https://github.com/joomla/joomla-cms into j…
…4finder_taxonomy

# Conflicts:
#	components/com_finder/helpers/html/filter.php
#	libraries/src/Categories/CategoryNode.php

Hackwar added some commits Nov 28, 2018

Merge branch '4.0-dev' of https://github.com/joomla/joomla-cms into j…
…4finder_taxonomy

# Conflicts:
#	administrator/components/com_finder/tmpl/maps/default.php
Merge branch '4.0-dev' of https://github.com/joomla/joomla-cms into j…
…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

This comment has been minimized.

Copy link
Member Author

Hackwar commented Jan 9, 2019

Right now this depends on #23452 being merged first.

Hackwar added some commits Jan 18, 2019

HLeithner and others added some commits Feb 17, 2019

Update plugins/finder/newsfeeds/newsfeeds.php
Co-Authored-By: Hackwar <info@joomlager.de>
Update plugins/finder/content/content.php
Co-Authored-By: Hackwar <info@joomlager.de>
Update plugins/finder/contacts/contacts.php
Co-Authored-By: Hackwar <info@joomlager.de>
@HLeithner

This comment has been minimized.

Copy link
Member

HLeithner commented Feb 17, 2019

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
Fixing comments
Fixing language branch display
@Hackwar

This comment has been minimized.

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

3 checks passed

continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/drone/pr the build was successful
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@wilsonge

This comment has been minimized.

Copy link
Contributor

wilsonge commented Feb 28, 2019

Looks like an improvement to me! Thanks!

@Hackwar

This comment has been minimized.

Copy link
Member Author

Hackwar commented Feb 28, 2019

💃 🍾 Thank you!

@zero-24 zero-24 added this to the Joomla 4.0 milestone Mar 1, 2019

dgrammatiko added a commit to dgrammatiko/joomla-cms that referenced this pull request Mar 5, 2019

Merge branch '4.0-dev' of github.com:joomla/joomla-cms into 4.o-dev-t…
…ools-refactoring-templates

* '4.0-dev' of github.com:joomla/joomla-cms: (153 commits)
  [4.0] Fix debug (joomla#23637)
  Fix typehint to be compatible with parent interface (joomla#24041)
  [4.0]Table text changed (joomla#24022)
  [4.0] Change Status dropdown consistency (joomla#24078)
  Fix Finder logging table creation in MySQL (joomla#24060)
  [4.0] Remove com_admin profile (joomla#24064)
  [4.0] Fix webcomponents not being included on the page (joomla#24075)
  Fix path to file (joomla#24074)
  Fix codestyle in mod search, move calendar locale to new location
  Fix stability
  Global checkin - select call style (joomla#24031)
  [4.0] An error has occurred on Search Filter (joomla#23679)
  [4.0] Group toolbar buttons for workflow stages and transitions (joomla#23608)
  com_finder update (joomla#24047)
  [4.0] Toolbar button consistency (joomla#24048)
  Fix default date for postgresql (joomla#24046)
  [4.0] Update bootstrap version (joomla#24003)
  [4.0][com_media] RTL: adapting media manager to rtl + some (joomla#24043)
  [4.0] Smart Search: Adding nested taxonomy (joomla#21327)
  [4.0] Update composer deps (joomla#24037)
  ...
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.