Flush the log index right before searching. If the search starts before the AILoggerPlugin finishes flushing the log, it will appear as if there are no results.
SKIndexFlush is thread-safe, and according to the docs: "Before searching an index, always call SKIndexFlush, even though the flush process may take up to several seconds. If there are no updates to commit, a call to SKIndexFlush does nothing and takes minimal time.", so it will never hurt doing this here.