/// <summary> /// Executes the SOLR delta import for specified collection. /// </summary> /// <param name="connection">Connection that specify collection to update.</param> /// <returns>Result of the operation.</returns> public string Execute(ISolrConnection connection) { if (connection == null) { throw new ArgumentNullException("connection"); } return connection.Post("/dataimport?command=delta-import", string.Empty); }
/// <summary> /// Executes this command /// </summary> /// <param name="connection"></param> /// <returns></returns> public string Execute(ISolrConnection connection) { var xml = new XmlDocument(); var node = xml.CreateElement("optimize"); foreach (var p in new[] {new KeyValuePair<bool?, string>(WaitSearcher, "waitSearcher"), new KeyValuePair<bool?, string>(WaitFlush, "waitFlush")}) { if (p.Key.HasValue) { var att = xml.CreateAttribute(p.Value); att.InnerText = p.Key.Value.ToString().ToLower(); node.Attributes.Append(att); } } return connection.Post("/update", node.OuterXml); }
public string Execute(ISolrConnection connection) { var xml = new XmlDocument(); var deleteNode = xml.CreateElement("delete"); foreach (var p in new[] {new KeyValuePair<bool?, string>(FromPending, "fromPending"), new KeyValuePair<bool?, string>(FromCommitted, "fromCommitted")}) { if (p.Key.HasValue) { var att = xml.CreateAttribute(p.Value); att.InnerText = p.Key.Value.ToString().ToLower(); deleteNode.Attributes.Append(att); } } deleteNode.InnerXml = Func.Join(Func.Select(deleteParam.ToXmlNode(), n => n.OuterXml)); return connection.Post("/update", deleteNode.OuterXml); }
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 node = new XElement("commit"); var keyValuePairs = new[] { new KeyValuePair<bool?, string>(WaitSearcher, "waitSearcher"), new KeyValuePair<bool?, string>(WaitFlush, "waitFlush"), new KeyValuePair<bool?, string>(ExpungeDeletes, "expungeDeletes") }; foreach (var p in keyValuePairs) { if (!p.Key.HasValue) continue; var att = new XAttribute(p.Value, p.Key.Value.ToString().ToLower()); node.Add(att); } if (MaxSegments.HasValue) { var att = new XAttribute("maxSegments", MaxSegments.ToString()); node.Add(att); } return connection.Post("/update", node.ToString(SaveOptions.DisableFormatting)); }
public string Execute(ISolrConnection connection) { var xml = new XmlDocument(); var node = xml.CreateElement("commit"); foreach (var p in new[] { new KeyValuePair<bool?, string>(WaitSearcher, "waitSearcher"), new KeyValuePair<bool?, string>(WaitFlush, "waitFlush"), new KeyValuePair<bool?, string>(ExpungeDeletes, "expungeDeletes") }) { if (!p.Key.HasValue) continue; var att = xml.CreateAttribute(p.Value); att.InnerText = p.Key.Value.ToString().ToLower(); node.Attributes.Append(att); } if (MaxSegments.HasValue) { var att = xml.CreateAttribute("maxSegments"); att.InnerText = MaxSegments.ToString(); node.Attributes.Append(att); } return connection.Post("/update", node.OuterXml); }
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); }
public string Execute(ISolrConnection connection) { return connection.Post("/update", "<rollback/>"); }
public string Post(string relativeUrl, string s) { logger.DebugFormat("POSTing '{0}' to '{1}'", s, relativeUrl); return(connection.Post(relativeUrl, s)); }
public async Task <string> Post(string relativeUrl, string s) { return(await conn.Post(relativeUrl, s)); }
public string Execute(ISolrConnection connection) { string xml = GetDeleteXml(); return(connection.Post("/update", xml)); }
public string Post(string relativeUrl, string s) { Console.WriteLine("Posting {0}", s); return(conn.Post(relativeUrl, s)); }