Example #1
0
        public void AppendQueryString(StringBuilder path)
        {
            path
            .Append("?query=");

            path.Append(Uri.EscapeUriString(Uri.EscapeDataString(Query ?? "")))
            .Append("&start=").Append(Start)
            .Append("&pageSize=").Append(PageSize)
            .Append("&aggregation=").Append(AggregationOperation);
            FieldsToFetch.ApplyIfNotNull(field => path.Append("&fetch=").Append(Uri.EscapeDataString(field)));
            GroupBy.ApplyIfNotNull(field => path.Append("&groupBy=").Append(Uri.EscapeDataString(field)));
            SortedFields.ApplyIfNotNull(
                field => path.Append("&sort=").Append(field.Descending ? "-" : "").Append(Uri.EscapeDataString(field.Field)));

            if (Cutoff != null)
            {
                var cutOffAsString =
                    Uri.EscapeUriString(Uri.EscapeDataString(Cutoff.Value.ToString("o", CultureInfo.InvariantCulture)));
                path.Append("&cutOff=").Append(cutOffAsString);
            }
            if (CutoffEtag != null)
            {
                path.Append("&cutOffEtag=").Append(CutoffEtag.Value.ToString());
            }
            var vars = GetCustomQueryStringVariables();

            if (!string.IsNullOrEmpty(vars))
            {
                path.Append(vars.StartsWith("&") ? vars : ("&" + vars));
            }
        }
Example #2
0
        public void AppendQueryString(StringBuilder path)
        {
            path.Append("?");

            AppendMinimalQueryString(path);

            if (Start != 0)
            {
                path.Append("&start=").Append(Start);
            }

            path.Append("&pageSize=").Append(PageSize);


            if (AggregationOperation != AggregationOperation.None)
            {
                path.Append("&aggregation=").Append(AggregationOperation);
            }

            FieldsToFetch.ApplyIfNotNull(field => path.Append("&fetch=").Append(Uri.EscapeDataString(field)));
            GroupBy.ApplyIfNotNull(field => path.Append("&groupBy=").Append(Uri.EscapeDataString(field)));
            SortedFields.ApplyIfNotNull(
                field => path.Append("&sort=").Append(field.Descending ? "-" : "").Append(Uri.EscapeDataString(field.Field)));



            if (SkipTransformResults)
            {
                path.Append("&skipTransformResults=true");
            }

            if (Cutoff != null)
            {
                var cutOffAsString =
                    Uri.EscapeUriString(Uri.EscapeDataString(Cutoff.Value.ToString("o", CultureInfo.InvariantCulture)));
                path.Append("&cutOff=").Append(cutOffAsString);
            }
            if (CutoffEtag != null)
            {
                path.Append("&cutOffEtag=").Append(CutoffEtag.Value.ToString());
            }

            this.HighlightedFields.ApplyIfNotNull(field => path.Append("&highlight=").Append(field));
            this.HighlighterPreTags.ApplyIfNotNull(tag => path.Append("&preTags=").Append(tag));
            this.HighlighterPostTags.ApplyIfNotNull(tag => path.Append("&postTags=").Append(tag));



            if (DebugOptionGetIndexEntries)
            {
                path.Append("&debug=entries");
            }
        }
Example #3
0
        public void AppendQueryString(StringBuilder path)
        {
            path
            .Append("?query=");

            path.Append(Uri.EscapeUriString(Uri.EscapeDataString(Query ?? "")))
            .Append("&start=").Append(Start)
            .Append("&pageSize=").Append(PageSize)
            .Append("&aggregation=").Append(AggregationOperation);
            FieldsToFetch.ApplyIfNotNull(field => path.Append("&fetch=").Append(Uri.EscapeDataString(field)));
            GroupBy.ApplyIfNotNull(field => path.Append("&groupBy=").Append(Uri.EscapeDataString(field)));
            SortedFields.ApplyIfNotNull(
                field => path.Append("&sort=").Append(field.Descending ? "-" : "").Append(Uri.EscapeDataString(field.Field)));

            if (string.IsNullOrEmpty(DefaultField) == false)
            {
                path.Append("&defaultField=").Append(Uri.EscapeDataString(DefaultField));
            }

            if (DefaultOperator != QueryOperator.Or)
            {
                path.Append("&operator=AND");
            }

            if (SkipTransformResults)
            {
                path.Append("&skipTransformResults=true");
            }

            if (Cutoff != null)
            {
                var cutOffAsString =
                    Uri.EscapeUriString(Uri.EscapeDataString(Cutoff.Value.ToString("o", CultureInfo.InvariantCulture)));
                path.Append("&cutOff=").Append(cutOffAsString);
            }
            if (CutoffEtag != null)
            {
                path.Append("&cutOffEtag=").Append(CutoffEtag.Value.ToString());
            }
            var vars = GetCustomQueryStringVariables();

            if (!string.IsNullOrEmpty(vars))
            {
                path.Append(vars.StartsWith("&") ? vars : ("&" + vars));
            }

            if (DebugOptionGetIndexEntries)
            {
                path.Append("&debug=entries");
            }
        }
Example #4
0
        /// <summary>
        /// Gets the index query URL.
        /// </summary>
        /// <param name="operationUrl">The operation URL.</param>
        /// <param name="index">The index.</param>
        /// <param name="operationName">Name of the operation.</param>
        /// <returns></returns>
        public string GetIndexQueryUrl(string operationUrl, string index, string operationName)
        {
            if (operationUrl.EndsWith("/"))
            {
                operationUrl = operationUrl.Substring(0, operationUrl.Length - 1);
            }
            var path = new StringBuilder()
                       .Append(operationUrl)
                       .Append("/")
                       .Append(operationName)
                       .Append("/")
                       .Append(index)
                       .Append("?query=").Append(Uri.EscapeUriString(Uri.EscapeDataString(Query ?? "")))
                       .Append("&start=").Append(Start)
                       .Append("&pageSize=").Append(PageSize)
                       .Append("&aggregation=").Append(AggregationOperation);

            FieldsToFetch.ApplyIfNotNull(field => path.Append("&fetch=").Append(Uri.EscapeDataString(field)));
            GroupBy.ApplyIfNotNull(field => path.Append("&groupBy=").Append(Uri.EscapeDataString(field)));
            SortedFields.ApplyIfNotNull(field => path.Append("&sort=").Append(field.Descending ? "-" : "").Append(Uri.EscapeDataString(field.Field)));

            if (Cutoff != null)
            {
                var cutOffAsString =
                    Uri.EscapeUriString(Uri.EscapeDataString(Cutoff.Value.ToString("o", CultureInfo.InvariantCulture)));
                path.Append("&cutOff=").Append(cutOffAsString);
            }
            var vars = GetCustomQueryStringVariables();

            if (!string.IsNullOrEmpty(vars))
            {
                path.Append(vars.StartsWith("&") ? vars : ("&" + vars));
            }

            return(path.ToString());
        }
Example #5
0
        public void AppendQueryString(StringBuilder path, bool includePageSizeEvenIfNotExplicitlySet = true)
        {
            path.Append("?");

            AppendMinimalQueryString(path);

            if (Start != 0)
            {
                path.Append("&start=").Append(Start);
            }

            if (includePageSizeEvenIfNotExplicitlySet || PageSizeSet)
            {
                path.Append("&pageSize=").Append(PageSize);
            }


            if (AggregationOperation != AggregationOperation.None)
            {
                path.Append("&aggregation=").Append(AggregationOperation);
            }

            FieldsToFetch.ApplyIfNotNull(field => path.Append("&fetch=").Append(Uri.EscapeDataString(field)));
            GroupBy.ApplyIfNotNull(field => path.Append("&groupBy=").Append(Uri.EscapeDataString(field)));
            SortedFields.ApplyIfNotNull(
                field => path.Append("&sort=").Append(field.Descending ? "-" : "").Append(Uri.EscapeDataString(field.Field)));



            if (SkipTransformResults)
            {
                path.Append("&skipTransformResults=true");
            }

            if (AllowMultipleIndexEntriesForSameDocumentToResultTransformer)
            {
                path.Append("&allowMultipleIndexEntriesForSameDocumentToResultTransformer=true");
            }


            if (string.IsNullOrEmpty(ResultsTransformer) == false)
            {
                path.AppendFormat("&resultsTransformer={0}", Uri.EscapeDataString(ResultsTransformer));
            }

            if (QueryInputs != null)
            {
                foreach (var input in QueryInputs)
                {
                    path.AppendFormat("&qp-{0}={1}", input.Key, input.Value);
                }
            }

            if (Cutoff != null)
            {
                var cutOffAsString = Uri.EscapeDataString(Cutoff.Value.ToString("o", CultureInfo.InvariantCulture));
                path.Append("&cutOff=").Append(cutOffAsString);
            }
            if (CutoffEtag != null)
            {
                path.Append("&cutOffEtag=").Append(CutoffEtag);
            }

            this.HighlightedFields.ApplyIfNotNull(field => path.Append("&highlight=").Append(field));
            this.HighlighterPreTags.ApplyIfNotNull(tag => path.Append("&preTags=").Append(tag));
            this.HighlighterPostTags.ApplyIfNotNull(tag => path.Append("&postTags=").Append(tag));



            if (DebugOptionGetIndexEntries)
            {
                path.Append("&debug=entries");
            }
        }