Tag cloud & category mindmap: search, clustering, server cache#220
Merged
Conversation
- Introduced a fuzzy-search input for tags in the tags cloud, allowing users to search and select tags easily. - Implemented a co-occurrence map to cluster tags that share posts, improving the visual layout of the tags cloud. - Updated the spiral packing algorithm to consider tag clusters, ensuring related tags are placed near each other. - Added a new function to refresh the layout based on the latest co-occurrence data. - Created comprehensive unit tests for the `/desktop-mode/v1/tag-cooccurrence` REST endpoint, covering authorization, response structure, and cache invalidation. - Ensured that the endpoint correctly handles various post statuses and limits the number of neighbors returned.
…dd tests for term counts endpoint
✅ WordPress Plugin Check Report
📊 ReportAll checks passed! No errors or warnings found. 🤖 Generated by WordPress Plugin Check Action • Learn more about Plugin Check |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a Content Graph–style search bar to the pixi tag cloud and category mindmap, pre-clusters the tag cloud by co-occurrence (tags that share posts sit near each other), and introduces a shared server cache with version-bump invalidation for the two terms-derived REST endpoints.
Search
wpd-mindmap__toolbarandwpd-tagcloud__toolbar.focusNode/focusTag.Co-occurrence clustering for tags
GET /desktop-mode/v1/tag-cooccurrence— one SQL scan overterm_relationships, returns top-N co-occurring siblings per tag with shared-post counts. Status filter mirrors core's_update_post_term_count.findSpiralSlotextended with an optional anchor; newpackBoxesWithClusterspulls each chip toward the centroid of its already-placed neighbors and seeds new clusters on a golden-angle meta-spiral when nothing co-occurs yet.Server cache
/tag-cooccurrenceand/term-counts. One version option (desktop_mode_terms_cache_version) keyed into both caches./term-countscaches the whole taxonomy under one key (dmtcnt_v{N}_{taxonomy}) and projects the caller's requested ID subset out of it — every client variant shares the same entry.set_object_terms,created_term,edited_term,delete_term,wp_trash_post,untrashed_post,before_delete_post). One option write retires every cached payload across both endpoints.DAY_IN_SECONDSas a floor on staleness if a hook ever fails to fire.Tests
Tests_DesktopMode_PostsWindowTagCooccurrence— 22 tests covering math, status filtering,limitcap, cache hit/miss, and per-hook invalidation.Tests_DesktopMode_PostsWindowTermCounts— 13 tests covering auth, ID projection, shared-cache projection across subsets, status filtering, cache hit/miss, invalidation, caps.npm run lint,tsc --noEmit,npm run test:js(1237 / 1237) — green.@group desktop-modePHPUnit: 780 / 781. The single failure is the pre-existingpluginsWindowRegistrationtest that tries to contact wordpress.org from the test container.