Skip to content

Add a taxonomy for hiding lessons#2830

Merged
adamwoodnz merged 8 commits intotrunkfrom
fix/2735-hidden-lessons-in-search
Aug 8, 2024
Merged

Add a taxonomy for hiding lessons#2830
adamwoodnz merged 8 commits intotrunkfrom
fix/2735-hidden-lessons-in-search

Conversation

@adamwoodnz
Copy link
Copy Markdown
Contributor

@adamwoodnz adamwoodnz commented Aug 7, 2024

Attempt to fix #2735

Using post meta to hide lessons in search results doesn't work with Jetpack classic search, so this PR attempts to fix this by using a taxonomy, which are indexed. As suggested by @gibrown here I've used an existing Jetpack taxonomy 'show' so that we don't need to add a new taxonomy.

I've left the existing post meta field for now while we migrate data to the new taxonomy, but a deprecation label has been added.

Screenshot 2024-08-08 at 2 47 43 PM

Testing

This can only be tested in sandbox, and I think it will need to be shipped to be fully tested, due to the Jetpack elastic search sync needing to be run. I've tried syncing before shipping and it doesn't seem to work.

@adamwoodnz adamwoodnz added [Component] Learn Theme Website development issues related to the Learn theme. [Component] Learn Plugin Website development issues related to the Learn plugin. labels Aug 7, 2024
@adamwoodnz adamwoodnz force-pushed the fix/2735-hidden-lessons-in-search branch from d760304 to 791b76e Compare August 7, 2024 02:58
@adamwoodnz adamwoodnz force-pushed the fix/2735-hidden-lessons-in-search branch from a16d6aa to 5dc406e Compare August 8, 2024 02:20
@adamwoodnz adamwoodnz force-pushed the fix/2735-hidden-lessons-in-search branch from 5dc406e to 1dd65f1 Compare August 8, 2024 02:21
@adamwoodnz adamwoodnz self-assigned this Aug 8, 2024

return (
<PluginDocumentSettingPanel title={ __( 'Hidden Lesson', 'wporg-learn' ) }>
<PluginDocumentSettingPanel title={ __( 'Hidden Lesson (deprecated)', 'wporg-learn' ) }>
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Delete this setting panel block once data migration is complete

$tax_query = $query->get( 'tax_query', array() );

$exclude_lesson_query = array(
$exclude_lessons_by_post_meta = array(
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Meta query can be removed once data migration is complete

@adamwoodnz adamwoodnz marked this pull request as ready for review August 8, 2024 02:39
@adamwoodnz adamwoodnz requested a review from outdoor2kode August 8, 2024 02:39
@adamwoodnz adamwoodnz merged commit bbe9ed4 into trunk Aug 8, 2024
@adamwoodnz adamwoodnz deleted the fix/2735-hidden-lessons-in-search branch August 8, 2024 23:24
@adamwoodnz
Copy link
Copy Markdown
Contributor Author

@gibrown @kangzj this has shipped now, but doesn't seem to have fixed this issue with hidden lessons appearing in search results. This production lesson 'Quiz time' has the 'hidden' term from the existing Jetpack 'show' taxonomy applied. It is hidden when viewing the archive, but visible in search:

I've used the jptools to check the post (id 257231) and I can see that it has the taxonomy applied.

I have tried to do an incremental sync, but discrepancies are still reported:

WP.com Cache has discrepancies as of last checksum on 2024-08-09 00:38:37


WP.com Cache Table Accuracy
posts: 100.00%
postmeta: 99.91%
comments: 100.00%
commentmeta: 100.00%
terms: 100.00%
term_relationships: 98.09%
term_taxonomy: 100.00%
users: 99.41%
usermeta: 99.42%

Should I try a full sync?

I have tried this in the test site too with a full sync and it's not working there either, but does work with Jetpack Search disabled:

JP search off JP search on
Screenshot 2024-08-09 at 12 29 32 PM Screenshot 2024-08-09 at 12 29 52 PM

Any idea what's going wrong?

Thanks in advance for your help.

@trakos
Copy link
Copy Markdown
Contributor

trakos commented Aug 14, 2024

I've replied in #2735

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Component] Learn Plugin Website development issues related to the Learn plugin. [Component] Learn Theme Website development issues related to the Learn theme.

Projects

Status: ✅ Done

Development

Successfully merging this pull request may close these issues.

Hidden Lessons appear in search results

2 participants