public void ExecuteSearch(Property[] inputs, RequiredProperties required, Property[] returns, MethodType methodType, ServiceObject serviceObject) { SPExecute Excute = new SPExecute(this.serviceBroker, this.Configuration); Excute.ExecuteSearch(inputs, required, returns, methodType, serviceObject); //serviceObject.Properties.InitResultTable(); //System.Data.DataRow dr; //try //{ // RESTSearchResultsSerialized SerializedResults = null; // // if deserializesearchresults // if(serviceObject.Methods[0].Name.Equals("deserializesearchresults")) // { // Property SerializedProp = inputs.Where(p => p.Name.Equals("serializedresults", StringComparison.OrdinalIgnoreCase)).First(); // string json = string.Empty; // json = SerializedProp.Value.ToString(); // SerializedResults = JsonConvert.DeserializeObject<RESTSearchResultsSerialized>(json.Trim()); // if (string.IsNullOrWhiteSpace(json) || SerializedResults == null) // { // throw new Exception("Failed to deserialize search results"); // } // } // if (serviceObject.Methods[0].Name.Equals("spsearch")) // { // // if Search // SerializedResults = Utilities.BrokerUtils.ExecuteSharePointSearch(inputs, required, Configuration, serviceBroker); // } // if (serviceObject.Methods[0].Name.Equals("spsearchraw")) // { // // if Search Raw Read // SerializedResults = Utilities.BrokerUtils.ExecuteSharePointSearchRaw(inputs, required, Configuration, serviceBroker); // } // if (SerializedResults != null) // { // // needs updating for REST // foreach (ResultRow result in SerializedResults.SearchResults.Rows) // { // dr = serviceBroker.ServicePackage.ResultTable.NewRow(); // if (!string.IsNullOrWhiteSpace(SerializedResults.Inputs.Search)) // { // dr["search"] = SerializedResults.Inputs.Search; // } // if (!string.IsNullOrWhiteSpace(SerializedResults.Inputs.SiteUrl)) // { // dr["searchsiteurl"] = SerializedResults.Inputs.Search; // } // if (!string.IsNullOrWhiteSpace(SerializedResults.Inputs.FileExtensionsString)) // { // dr["fileextensionsfilter"] = SerializedResults.Inputs.FileExtensionsString; // } // if (SerializedResults.Inputs.SourceId != null && SerializedResults.Inputs.SourceId != Guid.Empty) // { // dr["sourceid"] = SerializedResults.Inputs.SourceId; // } // if (!string.IsNullOrWhiteSpace(SerializedResults.Inputs.SortString)) // { // dr["sort"] = SerializedResults.Inputs.SortString; // } // if (SerializedResults.Inputs.StartRow.HasValue && SerializedResults.Inputs.StartRow.Value > -1) // { // dr["startrow"] = SerializedResults.Inputs.StartRow.Value; // } // if (SerializedResults.Inputs.RowLimit.HasValue && SerializedResults.Inputs.RowLimit.Value > 0) // { // dr["rowlimit"] = SerializedResults.Inputs.RowLimit.Value; // } // if (!string.IsNullOrWhiteSpace(SerializedResults.Inputs.Properties)) // { // dr["properties"] = SerializedResults.Inputs.Properties; // } // if (SerializedResults.Inputs.EnableStemming.HasValue && SerializedResults.Inputs.EnableStemming.Value) // { // dr["enablestemming"] = SerializedResults.Inputs.EnableStemming.Value; // } // if (SerializedResults.Inputs.TrimDuplicates.HasValue && SerializedResults.Inputs.TrimDuplicates.Value) // { // dr["trimduplicates"] = SerializedResults.Inputs.TrimDuplicates.Value; // } // if (SerializedResults.Inputs.EnableQueryRules.HasValue && SerializedResults.Inputs.EnableQueryRules.Value) // { // dr["enablequeryrules"] = SerializedResults.Inputs.EnableQueryRules.Value; // } // if (SerializedResults.Inputs.ProcessBestBets.HasValue && SerializedResults.Inputs.ProcessBestBets.Value) // { // dr["processbestbets"] = SerializedResults.Inputs.ProcessBestBets.Value; // } // if (SerializedResults.Inputs.ProcessPersonal.HasValue && SerializedResults.Inputs.ProcessPersonal.Value) // { // dr["processpersonal"] = SerializedResults.Inputs.ProcessPersonal.Value; // } // if (SerializedResults.Inputs.EnableNicknames.HasValue && SerializedResults.Inputs.EnableNicknames.Value) // { // dr["enablenicknames"] = SerializedResults.Inputs.EnableNicknames.Value; // } // if (SerializedResults.Inputs.EnablePhonetic.HasValue && SerializedResults.Inputs.EnablePhonetic.Value) // { // dr["enablephonetic"] = SerializedResults.Inputs.EnablePhonetic.Value; // } // if (SerializedResults.ExecutionTime.HasValue) // { // dr["executiontime"] = SerializedResults.ExecutionTime.Value; // } // if (SerializedResults.ResultRows.HasValue) // { // dr["resultrows"] = SerializedResults.ResultRows.Value; // } // if (SerializedResults.TotalRows.HasValue) // { // dr["totalrows"] = SerializedResults.TotalRows.Value; // } // List<string> missingprops = new List<string>(); // foreach (ResultCell cell in result.Cells) // { // if (dr.Table.Columns.Contains(cell.Key.ToLower())) // { // if (cell.Value != null) // { // dr[cell.Key.ToLower()] = cell.Value; // } // } // else // { // missingprops.Add(cell.Key); // } // } // dr["responsestatus"] = ResponseStatus.Success; // serviceBroker.ServicePackage.ResultTable.Rows.Add(dr); // } // } // else // { // throw new Exception("No results returned."); // } //} //catch (Exception ex) //{ // dr = serviceBroker.ServicePackage.ResultTable.NewRow(); // dr["responsestatus"] = ResponseStatus.Error; // dr["responsestatusdescription"] = ex.Message; // serviceBroker.ServicePackage.ResultTable.Rows.Add(dr); //} ////serviceObject.Properties.BindPropertiesToResultTable(); }
public void ExecuteSearch(Property[] inputs, RequiredProperties required, Property[] returns, MethodType methodType, ServiceObject serviceObject) { SPExecute Excute = new SPExecute(this.serviceBroker, this.Configuration); Excute.ExecuteSearch(inputs, required, returns, methodType, serviceObject); }
public void ExecuteSearch(Property[] inputs, RequiredProperties required, Property[] returns, MethodType methodType, ServiceObject serviceObject) { SPExecute Excute = new SPExecute(this.serviceBroker, this.Configuration); Excute.ExecuteSearch(inputs, required, returns, methodType, serviceObject); }
public void ExecuteSearch(Property[] inputs, RequiredProperties required, Property[] returns, MethodType methodType, ServiceObject serviceObject) { SPExecute Excute = new SPExecute(this.serviceBroker, this.Configuration); Excute.ExecuteSearch(inputs, required, returns, methodType, serviceObject); //serviceObject.Properties.InitResultTable(); //System.Data.DataRow dr; //try //{ // RESTSearchResultsSerialized SerializedResults = null; // // if deserializesearchresults // if(serviceObject.Methods[0].Name.Equals("deserializesearchresults")) // { // Property SerializedProp = inputs.Where(p => p.Name.Equals("serializedresults", StringComparison.OrdinalIgnoreCase)).First(); // string json = string.Empty; // json = SerializedProp.Value.ToString(); // SerializedResults = JsonConvert.DeserializeObject<RESTSearchResultsSerialized>(json.Trim()); // if (string.IsNullOrWhiteSpace(json) || SerializedResults == null) // { // throw new Exception("Failed to deserialize search results"); // } // } // if (serviceObject.Methods[0].Name.Equals("spsearch")) // { // // if Search // SerializedResults = Utilities.BrokerUtils.ExecuteSharePointSearch(inputs, required, Configuration, serviceBroker); // } // if (serviceObject.Methods[0].Name.Equals("spsearchraw")) // { // // if Search Raw Read // SerializedResults = Utilities.BrokerUtils.ExecuteSharePointSearchRaw(inputs, required, Configuration, serviceBroker); // } // if (SerializedResults != null) // { // // needs updating for REST // foreach (ResultRow result in SerializedResults.SearchResults.Rows) // { // dr = serviceBroker.ServicePackage.ResultTable.NewRow(); // if (!string.IsNullOrWhiteSpace(SerializedResults.Inputs.Search)) // { // dr["search"] = SerializedResults.Inputs.Search; // } // if (!string.IsNullOrWhiteSpace(SerializedResults.Inputs.SiteUrl)) // { // dr["searchsiteurl"] = SerializedResults.Inputs.Search; // } // if (!string.IsNullOrWhiteSpace(SerializedResults.Inputs.FileExtensionsString)) // { // dr["fileextensionsfilter"] = SerializedResults.Inputs.FileExtensionsString; // } // if (SerializedResults.Inputs.SourceId != null && SerializedResults.Inputs.SourceId != Guid.Empty) // { // dr["sourceid"] = SerializedResults.Inputs.SourceId; // } // if (!string.IsNullOrWhiteSpace(SerializedResults.Inputs.SortString)) // { // dr["sort"] = SerializedResults.Inputs.SortString; // } // if (SerializedResults.Inputs.StartRow.HasValue && SerializedResults.Inputs.StartRow.Value > -1) // { // dr["startrow"] = SerializedResults.Inputs.StartRow.Value; // } // if (SerializedResults.Inputs.RowLimit.HasValue && SerializedResults.Inputs.RowLimit.Value > 0) // { // dr["rowlimit"] = SerializedResults.Inputs.RowLimit.Value; // } // if (!string.IsNullOrWhiteSpace(SerializedResults.Inputs.Properties)) // { // dr["properties"] = SerializedResults.Inputs.Properties; // } // if (SerializedResults.Inputs.EnableStemming.HasValue && SerializedResults.Inputs.EnableStemming.Value) // { // dr["enablestemming"] = SerializedResults.Inputs.EnableStemming.Value; // } // if (SerializedResults.Inputs.TrimDuplicates.HasValue && SerializedResults.Inputs.TrimDuplicates.Value) // { // dr["trimduplicates"] = SerializedResults.Inputs.TrimDuplicates.Value; // } // if (SerializedResults.Inputs.EnableQueryRules.HasValue && SerializedResults.Inputs.EnableQueryRules.Value) // { // dr["enablequeryrules"] = SerializedResults.Inputs.EnableQueryRules.Value; // } // if (SerializedResults.Inputs.ProcessBestBets.HasValue && SerializedResults.Inputs.ProcessBestBets.Value) // { // dr["processbestbets"] = SerializedResults.Inputs.ProcessBestBets.Value; // } // if (SerializedResults.Inputs.ProcessPersonal.HasValue && SerializedResults.Inputs.ProcessPersonal.Value) // { // dr["processpersonal"] = SerializedResults.Inputs.ProcessPersonal.Value; // } // if (SerializedResults.Inputs.EnableNicknames.HasValue && SerializedResults.Inputs.EnableNicknames.Value) // { // dr["enablenicknames"] = SerializedResults.Inputs.EnableNicknames.Value; // } // if (SerializedResults.Inputs.EnablePhonetic.HasValue && SerializedResults.Inputs.EnablePhonetic.Value) // { // dr["enablephonetic"] = SerializedResults.Inputs.EnablePhonetic.Value; // } // if (SerializedResults.ExecutionTime.HasValue) // { // dr["executiontime"] = SerializedResults.ExecutionTime.Value; // } // if (SerializedResults.ResultRows.HasValue) // { // dr["resultrows"] = SerializedResults.ResultRows.Value; // } // if (SerializedResults.TotalRows.HasValue) // { // dr["totalrows"] = SerializedResults.TotalRows.Value; // } // List<string> missingprops = new List<string>(); // foreach (ResultCell cell in result.Cells) // { // if (dr.Table.Columns.Contains(cell.Key.ToLower())) // { // if (cell.Value != null) // { // dr[cell.Key.ToLower()] = cell.Value; // } // } // else // { // missingprops.Add(cell.Key); // } // } // dr["responsestatus"] = ResponseStatus.Success; // serviceBroker.ServicePackage.ResultTable.Rows.Add(dr); // } // } // else // { // throw new Exception("No results returned."); // } //} //catch (Exception ex) //{ // dr = serviceBroker.ServicePackage.ResultTable.NewRow(); // dr["responsestatus"] = ResponseStatus.Error; // dr["responsestatusdescription"] = ex.Message; // serviceBroker.ServicePackage.ResultTable.Rows.Add(dr); //} ////serviceObject.Properties.BindPropertiesToResultTable(); }