public string Execute(ISolrConnection connection) { var deleteNode = new XElement("delete"); if (parameters != null) { if (parameters.CommitWithin.HasValue) { var attr = new XAttribute("commitWithin", parameters.CommitWithin.Value.ToString(CultureInfo.InvariantCulture)); deleteNode.Add(attr); } } var param = new[] { KV.Create(FromPending, "fromPending"), KV.Create(FromCommitted, "fromCommitted") }; foreach (var p in param) { if (p.Key.HasValue) { var att = new XAttribute(p.Value, p.Key.Value.ToString().ToLower()); deleteNode.Add(att); } } deleteNode.Add(deleteParam.ToXmlNode().ToArray()); return(connection.Post("/update", deleteNode.ToString(SaveOptions.DisableFormatting))); }
public string Execute(ISolrConnection connection) { var xml = new XmlDocument(); var deleteNode = xml.CreateElement("delete"); if (parameters != null) { if (parameters.CommitWithin.HasValue) { var attr = xml.CreateAttribute("commitWithin"); attr.Value = parameters.CommitWithin.Value.ToString(CultureInfo.InvariantCulture); deleteNode.Attributes.Append(attr); } } var param = new[] { KV.Create(FromPending, "fromPending"), KV.Create(FromCommitted, "fromCommitted") }; foreach (var p in param) { if (p.Key.HasValue) { var att = xml.CreateAttribute(p.Value); att.InnerText = p.Key.Value.ToString().ToLower(); deleteNode.Attributes.Append(att); } } deleteNode.InnerXml = string.Join("", deleteParam.ToXmlNode().Select(n => n.OuterXml).ToArray()); return(connection.Post("/update", deleteNode.OuterXml)); }
private string GetDeleteXml() { var deleteNode = new XElement("delete"); if (parameters != null) { if (parameters.CommitWithin.HasValue) { var attr = new XAttribute("commitWithin", parameters.CommitWithin.Value.ToString(CultureInfo.InvariantCulture)); deleteNode.Add(attr); } } var param = new[] { KV.Create(FromPending, "fromPending"), KV.Create(FromCommitted, "fromCommitted") }; foreach (var p in param) { if (p.Key.HasValue) { var att = new XAttribute(p.Value, p.Key.Value.ToString().ToLower()); deleteNode.Add(att); } } deleteNode.Add(deleteParam.ToXmlNode().ToArray()); var xml = deleteNode.ToString(SaveOptions.DisableFormatting); return(xml); }