private static void CopySearchRequestParameters <T>(MoreLikeThisDescriptor <T> d) where T : class { if (d._Search == null) { return; } d._QueryString.CopyQueryStringValuesFrom(d._Search._QueryString); }
private static void CopySearchQueryString <T>(MoreLikeThisDescriptor <T> d) where T : class { if (d._Search != null) { var searchQs = d._Search._QueryString._QueryStringDictionary; foreach (var k in searchQs.Keys) { d._QueryString._QueryStringDictionary[k] = searchQs[k]; } } }
/// <summary> /// Search using T as the return type /// </summary> public IQueryResponse <T> MoreLikeThis <T>(Func <MoreLikeThisDescriptor <T>, MoreLikeThisDescriptor <T> > mltSelector) where T : class { var mltDescriptor = new MoreLikeThisDescriptor <T>(); var descriptor = mltSelector(mltDescriptor); var path = this.PathResolver.GetMoreLikeThisPathFor(descriptor); ConnectionStatus status = null; if (descriptor._Search == null) { status = this.Connection.GetSync(path); } else { var search = this.Serialize(descriptor._Search); status = this.Connection.PostSync(path, search); } return(this.Deserialize <QueryResponse <T> >(status)); }
/// <summary> /// Search using T as the return type /// </summary> public IQueryResponse <T> MoreLikeThis <T>(Func <MoreLikeThisDescriptor <T>, MoreLikeThisDescriptor <T> > mltSelector) where T : class { var mltDescriptor = new MoreLikeThisDescriptor <T>(); var descriptor = mltSelector(mltDescriptor); var path = this.PathResolver.GetMoreLikeThisPathFor(descriptor); ConnectionStatus status = null; if (descriptor._Search == null) { status = this.Connection.GetSync(path); } else { var search = this.Serialize(descriptor._Search); status = this.Connection.PostSync(path, search); } return(this.Deserialize <QueryResponse <T> >(status, extraConverters: new List <JsonConverter> { new ConcreteTypeConverter(typeof(T), (d, h) => typeof(T)) })); }