I'm using Solarium with Solr 4 and I need to delete with multiple criteria. The docs show how to delete with a query
$client = new Solarium\Client($config);
$update = $client->createUpdate();
$update->addDeleteQuery('type:comment');
$update->addCommit();
$result = $client->update($update);
This works fine. But if I need a different criteria, eg writer_id:123, I'm not sure what to do. If I add another addDeleteQuery line the final raw query looks like:
<update>
<delete>
<query>type:comment</query>
</delete>
<delete>
<query>writer_id:123</query>
</delete>
<commit/>
</update>
It seems this will delete them independently. I'm not sure if it matters but the defaultOperator from the schema is AND. Looks like from http://www.solarium-project.org/forums/topic/change-operator/ that it's not easily overridable yet. I'm not sure how to apply the solution there to delete, if that would work even work here.
How can I delete items in solr using multiple criteria?
Try Clubbing it into a single query <delete><query>type:comment AND writer_id:123</query></delete>