One thing to keep in mind is that we never “live publish” our posts – they’re almost always scheduled using the native wordpress scheduled posts capability. Could this in some way be preventing these from being indexed?
FWIW, I tested turning on the search within admin feature, and created a new post, and none of my drafts or pending posts show up when I search either. For now, I’ve disabled the admin search feature, but I still need a better way to ensure new posts are indexed.
I thought about using the cron method, but we have very large databases on each site, and I’m concerned that a full daily rebuild could be a big resource hog.
Oh, and one last note. It seems that simply clicking “Continue Indexing” in the interface adds the recently added documents without a full reindex. Is it possible to use cron to just call this function instead of a full reindex, or will it cause other problems?
Would adding (true) to the relevanssi_build_index call work to reindex only posts not already indexed?
if (!wp_next_scheduled('relevanssi_build_index')) {
wp_schedule_event( time(), 'daily', 'relevanssi_build_index(true)' );
}
Just a thought I had. Ideally, though, the standard save_post hook would work so they’d be added immediately once saved (or published).
Indexing scheduled posts shouldn’t be a problem. I tested this on my test blog and it worked as it should: saved posts are indexed, as are scheduled posts. Drafts also appear in admin search.
So, it’s something else. Is there something that might be interfering with the regular save_post filter? Since you’re a Premium subscriber, you could drop me a mail through the Premium Support contact form with more details.
Your idea of a cron job should work, yes.
I dropped you a note with details on the plugins installed on my sites as well as a couple more details up on the support form. Let me know if that helps nail down the cause. If not, I might have to go the cron route.