+sub quote_for_xapian {
+ my $str = shift;
+ $str =~ s/"/""/g;
+ return '"' . $str . '"';
+}
+
+sub pair_to_batch_line {
+ my ($action, $pair) = @_;
+
+ # the tag should already be suitably encoded
+
+ return $action . $ENCPREFIX . $pair->{tag} .
+ ' -- id:' . quote_for_xapian ($pair->{id})."\n";
+}