public bool Search() { var client = new SearchProviderClient(QuelleControlConfig.search.host); var request = new QRequestSearch(this.statement); // (IQuelleSearchRequest) IQuelleSearchResult response = client.api.Search(request); return(response != null && response.messages.Count == 0); }
//IQuelleStatusResult Status(); public IQuelleSearchResult Search(QRequestSearch request) { if (instance != null) { var result = instance.Search(request); return(result); } else { Console.Out.WriteLine("Error: " + "Could not locate a Quelle search provider/instance"); return(null); } }
public IQuelleSearchResult Search(QRequestSearch req) { var cloud = new QWebClient(this.baseUrl); if (cloud != null) { try { var payload = JsonSerializer.Serialize(req); var packedResponse = cloud.Post("/search", payload, mimetype); var str = System.Text.Encoding.Default.GetString(packedResponse.data).Trim(); var response = JsonSerializer.Deserialize <QSearchResult>(packedResponse.data); return(response); } catch (Exception ex) { var bad = new QSearchResult(); bad.AddError("Unable to pack message (before calling search provider)"); return(bad); } } return(null); }
public bool Search(ISearchProvider provider) { var request = new QRequestSearch(this.statement); // (IQuelleSearchRequest) IQuelleSearchResult response = provider != null?provider.Search(request) : null; if (response != null) { var messages = response.messages; var errors = new List <String>(); var warnings = new List <String>(); if (messages != null) { foreach (var entry in messages) { if (entry.Key == "errors") { foreach (var message in entry.Value) { if (!errors.Contains(message)) { errors.Add(message); } } } } foreach (var entry in messages) { if (entry.Key != "errors") { foreach (var message in entry.Value) { if (!warnings.Contains(message)) { warnings.Add(message); } } } } foreach (var error in errors) { Console.Out.WriteLine("Error: " + error); } foreach (var warning in warnings) { Console.Out.WriteLine("Warning: " + warning); } } } if (errors.Count == 0 && response.matches != null) { foreach (var book in response.matches) { UInt16 b = book.Key; var chapters = response.matches[book.Key]; foreach (var chapter in book.Value) { UInt16 c = chapter.Key; var verses = Quelle.DriverDefault.Utility.ExpandBitArray(chapter.Value); foreach (var verse in verses) { UInt16 v = verse; Console.Out.WriteLine(b.ToString() + ':' + c.ToString() + ':' + v.ToString()); } } } } return(response != null && (response.messages == null || response.messages.Count == 0)); }
//IQuelleStatusResult Status(); public abstract IQuelleSearchResult Search(QRequestSearch request);
//public IQuelleStatusResult Status() //{ // return outer.Status(); //} public IQuelleSearchResult Search(IQuelleSearchRequest request) { var qrequest = new QRequestSearch(request); return(outer.Search(qrequest)); }
//public IQuelleStatusResult Status() { // return outer.Status(); //} public IQuelleSearchResult Search(QRequestSearch request) { return(this.outer.Search(request)); //outer.Test("foo"); //return null; }