If I do the following:
$solr->deleteByQuery('nid:'.$nid);
$solr->addDocument($doc);
$solr->search('*:*', 0, 0, array('fq' => 'type:datacollection', 'facet.limit' => -1, 'facet' => 'true', 'facet.field' => 'nid', 'facet.mincount' => 1));
$solr->commit();
2 questions:
- Will the delete happen and then the add (in that order)
- will the search take into account that I did a delete and an add? (or would I have to do the search after the commit)
The search won’t see your delete and add results unless you issue a commit. You will see those changes only if someone else is doing a commit, since your code issues the commit only after the search.
Of course, the delete will happen before the add. They are synchronous commands, they are executed right when you send them to Solr.