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

Posts created before index is active don’t get deleted #107

Closed
richaber opened this issue Oct 15, 2020 · 3 comments · Fixed by #108
Closed

Posts created before index is active don’t get deleted #107

richaber opened this issue Oct 15, 2020 · 3 comments · Fixed by #108
Assignees
Labels
bug Something isn't working

Comments

@richaber
Copy link
Contributor

@ericmulder has described an issue with meta used for indexing in the WPORG support forum:
https://wordpress.org/support/topic/posts-created-before-index-is-active-dont-get-deleted/

When you activate an index, the posts created before that get synced, but don’t receive a post_meta field called algolia_posts_{index}_records_count. It turns out that that meta is used to delete the post from the index. This causes orphaned posts in the algolia index which leads to confusing 404 search results. I created a video with a basic wordpress site demonstrating the issue.

There is a link to the screen recording in the support forum post for further study.

@richaber richaber added the bug Something isn't working label Oct 15, 2020
@richaber richaber pinned this issue Oct 16, 2020
@asharirfan
Copy link
Contributor

EOD Update:
I have been able to reproduce the issue on my local. Right now, I am getting myself familiar with the codebase and working on a possible solution for this problem.

@asharirfan asharirfan self-assigned this Oct 16, 2020
@ericmulder
Copy link

ericmulder commented Oct 19, 2020

The record count is set in two places (depending on the index type): https://github.com/WebDevStudios/wp-search-with-algolia/search?q=set_post_records_count

These functions are called from update_records which is called from the sync functions (which are called from the sync_item function here).

The re_index function only exists in the parent class, and doesn't call the update_records function

@ericmulder
Copy link

Thanks!

@richaber richaber unpinned this issue Nov 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants