Пример #1
0
        public void Execute()
        {
            var fieldName = this.ExpressionBuilder.GetFieldName(this.FieldExpression);
            var formule   = ParameterUtil.GetSpatialFormule(fieldName, this.FunctionType, this.CenterPoint, this.Distance);
            var facetName = ParameterUtil.GetFacetName(this.Excludes, this.AliasName, formule);

            this._result.Add($"facet.query={facetName}");

            if (this.SortType.HasValue)
            {
                Checker.IsTrue <UnsupportedFeatureException>(this.SortType.Value == FacetSortType.CountDesc || this.SortType.Value == FacetSortType.IndexDesc);

                ParameterUtil.GetFacetSort(this.SortType.Value, out string typeName, out string dummy);

                this._result.Add($"f.{this.AliasName}.facet.sort={typeName}");
            }

            if (this.Minimum.HasValue)
            {
                this._result.Add($"f.{this.AliasName}.facet.mincount={this.Minimum.Value}");
            }

            if (this.Limit.HasValue)
            {
                this._result.Add($"f.{this.AliasName}.facet.limit={this.Limit.Value}");
            }
        }
        public void Execute()
        {
            Checker.IsNull(this.Query);
            Checker.IsTrue <UnsupportedFeatureException>(this.Filter != null);

            var query = this.Query.Execute();

            this._result.Add($"facet.query={ParameterUtil.GetFacetName(this.Excludes, this.AliasName, query)}");

            if (this.SortType.HasValue)
            {
                Checker.IsTrue <UnsupportedFeatureException>(this.SortType.Value == FacetSortType.CountDesc || this.SortType.Value == FacetSortType.IndexDesc);

                ParameterUtil.GetFacetSort(this.SortType.Value, out string typeName, out string dummy);

                this._result.Add($"f.{this.AliasName}.facet.sort={typeName}");
            }

            if (this.Minimum.HasValue)
            {
                this._result.Add($"f.{this.AliasName}.facet.mincount={this.Minimum.Value}");
            }

            if (this.Limit.HasValue)
            {
                this._result.Add($"f.{this.AliasName}.facet.limit={this.Limit.Value}");
            }
        }
        public void Execute()
        {
            Checker.IsNull(this.FieldExpression);
            Checker.IsTrue <UnsupportedFeatureException>(this.Filter != null);

            var aliasName  = this.ExpressionBuilder.GetAliasName(this.FieldExpression);
            var fieldName  = this.ExpressionBuilder.GetFieldName(this.FieldExpression);
            var facetField = ParameterUtil.GetFacetName(this.Excludes, aliasName, fieldName);

            this._result.Add($"facet.field={facetField}");

            if (this.SortType.HasValue)
            {
                Checker.IsTrue <UnsupportedFeatureException>(this.SortType == FacetSortType.CountDesc || this.SortType == FacetSortType.IndexDesc);

                ParameterUtil.GetFacetSort(this.SortType.Value, out string typeName, out string dummy);

                this._result.Add($"f.{fieldName}.facet.sort={typeName}");
            }

            if (this.Minimum.HasValue)
            {
                this._result.Add($"f.{fieldName}.facet.mincount={this.Minimum.Value}");
            }

            if (this.Limit.HasValue)
            {
                this._result.Add($"f.{fieldName}.facet.limit={this.Limit.Value}");
            }

            if (this.MethodType.HasValue)
            {
                var methodName = string.Empty;
                switch (this.MethodType.Value)
                {
                case FacetMethodType.UninvertedField:
                    methodName = "fc";
                    break;

                case FacetMethodType.DocValues:
                    methodName = "enum";
                    break;

                case FacetMethodType.Stream:
                    methodName = "fcs";
                    break;

                default:
                    throw new ArgumentOutOfRangeException(nameof(this.MethodType));
                }

                this._result.Add($"f.{fieldName}.facet.method={methodName}");
            }

            if (!string.IsNullOrWhiteSpace(this.Prefix))
            {
                this._result.Add($"f.{fieldName}.facet.prefix={this.Prefix}");
            }
        }
        public void Execute()
        {
            Checker.IsTrue <UnsupportedFeatureException>(this.Filter != null);

            var fieldName = this.ExpressionBuilder.GetFieldName(this.FieldExpression);
            var facetName = ParameterUtil.GetFacetName(this.Excludes, this.AliasName, fieldName);

            this._result.Add($"facet.range={facetName}");

            if (!string.IsNullOrWhiteSpace(this.Gap))
            {
                this._result.Add($"f.{fieldName}.facet.range.gap={Uri.EscapeDataString(this.Gap)}");
            }
            if (!string.IsNullOrWhiteSpace(this.Start))
            {
                this._result.Add($"f.{fieldName}.facet.range.start={Uri.EscapeDataString(this.Start)}");
            }
            if (!string.IsNullOrWhiteSpace(this.End))
            {
                this._result.Add($"f.{fieldName}.facet.range.end={Uri.EscapeDataString(this.End)}");
            }

            if (this.CountBefore)
            {
                this._result.Add($"f.{fieldName}.facet.range.other=before");
            }

            if (this.CountAfter)
            {
                this._result.Add($"f.{fieldName}.facet.range.other=after");
            }

            if (this.HardEnd)
            {
                this._result.Add($"f.{fieldName}.facet.range.hardend=true");
            }

            if (this.SortType.HasValue)
            {
                Checker.IsTrue <UnsupportedFeatureException>(this.SortType.Value == FacetSortType.CountDesc || this.SortType.Value == FacetSortType.IndexDesc);

                ParameterUtil.GetFacetSort(this.SortType.Value, out string typeName, out string dummy);

                this._result.Add($"f.{fieldName}.facet.sort={typeName}");
            }

            if (this.Minimum.HasValue)
            {
                this._result.Add($"f.{fieldName}.facet.mincount={this.Minimum.Value}");
            }

            if (this.Limit.HasValue)
            {
                this._result.Add($"f.{fieldName}.facet.limit={this.Limit.Value}");
            }
        }