/// <summary> /// Prepares query parameters for /search /// </summary> /// <param name="x"></param> /// <param name="luceneQuery"></param> /// <param name="maxSize"></param> /// <returns></returns> protected SearchRequestParameters getSearchParameters(SearchRequestParameters x, string luceneQuery, int maxSize, bool scroll = false) { if (string.IsNullOrEmpty(luceneQuery)) { throw new ArgumentNullException("luceneQuery"); } if (maxSize > 0 && maxSize < int.MaxValue) { x = x.AddQueryString("size", maxSize.ToString()); } if (scroll) { x = x.AddQueryString("scroll", "1m"); } x = x.AddQueryString("q", luceneQuery); return(x); }
///<summary>Specify which field to use for suggestions</summary> internal static SearchRequestParameters _SuggestField <T>( this SearchRequestParameters qs, Expression <Func <T, object> > suggest_field) where T : class { var p = (PropertyPathMarker)suggest_field; var _suggest_field = p; qs.AddQueryString("suggest_field", _suggest_field); return(qs); }
///<summary>Specify which field to use for suggestions</summary> internal static SearchRequestParameters _SuggestField <T>(this SearchRequestParameters qs, Expression <Func <T, object> > suggest_field) where T : class => qs.AddQueryString("suggest_field", (Field)suggest_field);
///<summary>A comma-separated list of fields to return as the docvalue representation of a field for each hit</summary> internal static SearchRequestParameters _DocvalueFields <T>(this SearchRequestParameters qs, IEnumerable <Expression <Func <T, object> > > docvalue_fields) where T : class => qs.AddQueryString("docvalue_fields", docvalue_fields.Select(e => (Field)e));