Support » Plugin: CloudSearch » Bug with Sync All and acs_exclude

  • Resolved McBoof

    (@mcboof)


    Hi there,

    (Thanks again for a great plugin!)

    I discovered what I think is a small bug today which took ages to track down. At the moment, if you use the acs_exclude custom field to exclude items from the index, it breaks the sync all functionality.

    The sync all code currently reads a chunk of 100 posts, and processes them. If the number processed is equal to the chunk size, then it gets the next chunk and all have been sync’ed. However, for example, 1 post is acs_excluded, then the number processed would only be 99 and so it thinks it is finished prematurely.

    This is the code in the sync loop that doesn’t increment the count in this case:

    if ( ! isset( $excluded ) || empty( $excluded ) || $excluded != 1 ) {
        // Prepare and add document
        $prepared_doc_array = acs_prepare_document( $item );
        if ( ! empty( $prepared_doc_array ) ) {
            $docs[] = $prepared_doc_array;
            $count = $count + 1;
        }
    }

    I’m tempted to say the fix should be to increment the count outside the if statement? The count should be the number of docs that we considered for indexing, not the actual number indexed?

    Thanks!
    Jon

Viewing 1 replies (of 1 total)
  • Plugin Author Andrea Landonio

    (@lando1982)

    Thanks Jon,
    Your suggestion sounds good! Let me try to test it and then I’ll release a fixed version of the plugin.

    Thanks again for your advise.. Very appreciated!

    Bye,
    Andrea

Viewing 1 replies (of 1 total)
  • The topic ‘Bug with Sync All and acs_exclude’ is closed to new replies.