1

I tried to use index the newly created contents to be able to test a page, but the problem is most of the times the tests fails, because the indexing process not finished yet until the contents starts checking. (i.e. if I stop before pageload with a breakpoint the testing, then the next steps always pass)

Method 1:

$search_api_index = search_api_index_load('SEARCH_API_INDEX_ID');
search_api_index_items($search_api_index);

Method 2:

search_api_cron();

The question, how can I call the indexing to wait until it's fully indexed before it goes forward?

1 Answer 1

1

The ultimate solution is $search_api_index->server()->commit() which needed because, there's a commit delay which you can set inside the solrconfig.xml and this delay cause the problem. (Or you can just sleep(1) your code, but that's not flexible at all and ugly...)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.