public static List <SkinnyItem> GetItems(string indexName,
                                                 string language,
                                                 string templateFilter,
                                                 string locationFilter,
                                                 string fullTextQuery,
                                                 List <NumericRangeSearchParam.NumericRangeField> ranges,
                                                 QueryOccurance occuranceTypeNumRanges = QueryOccurance.Must,
                                                 bool performSort     = false,
                                                 string sortFieldName = "",
                                                 bool reverse         = false)
        {
            var searchParam = new NumericRangeSearchParam
            {
                Database       = "web",
                Ranges         = ranges,
                LocationIds    = locationFilter,
                TemplateIds    = templateFilter,
                FullTextQuery  = fullTextQuery,
                InnerCondition = occuranceTypeNumRanges,
                Language       = language
            };

            using (var runner = new QueryRunner(indexName))
            {
                if (performSort)
                {
                    return(runner.GetItems(searchParam, sortField: sortFieldName, reverse: reverse));
                }
                else
                {
                    return(runner.GetItems(searchParam));
                }
            }
        }
        public static List <SkinnyItem> GetItems(string indexName,
                                                 string language,
                                                 string templateFilter,
                                                 string locationFilter,
                                                 string fullTextQuery,
                                                 bool performSort     = false,
                                                 string sortFieldName = "",
                                                 bool reverse         = false)
        {
            var searchParam = new SearchParam
            {
                Database      = "web",
                Language      = language,
                TemplateIds   = templateFilter,
                LocationIds   = locationFilter,
                FullTextQuery = fullTextQuery
            };

            using (var runner = new QueryRunner(indexName))
            {
                if (performSort)
                {
                    return(runner.GetItems(searchParam, sortField: sortFieldName, reverse: reverse));
                }
                else
                {
                    return(runner.GetItems(searchParam));
                }
            }
        }
Example #3
0
        public override List <SkinnyItem> GetItems(string databaseName,
                                                   string indexName,
                                                   string language,
                                                   string templateFilter,
                                                   string locationFilter,
                                                   string fullTextQuery)
        {
            var refinements = GetRefinements();

            var searchParam = new MultiFieldSearchParam
            {
                Database       = databaseName,
                Refinements    = refinements,
                InnerCondition = GetCondition(OccuranceList),
                LocationIds    = locationFilter,
                TemplateIds    = templateFilter,
                FullTextQuery  = fullTextQuery,
                Language       = language
            };

            using (var runner = new QueryRunner(indexName))
            {
                return(runner.GetItems(searchParam));
            }
        }
Example #4
0
        public override List <SkinnyItem> GetItems(string databaseName,
                                                   string indexName,
                                                   string language,
                                                   string templateFilter,
                                                   bool searchBaseTemplates,
                                                   string locationFilter,
                                                   string fullTextQuery)
        {
            var searchParam = new FieldSearchParam
            {
                Database            = databaseName,
                Language            = language,
                FieldName           = this.FieldName.Text,
                FieldValue          = this.FieldValue.Text,
                TemplateIds         = templateFilter,
                SearchBaseTemplates = searchBaseTemplates,
                LocationIds         = locationFilter,
                FullTextQuery       = fullTextQuery,
                Partial             = this.Partial.Checked
            };

            using (var runner = new QueryRunner(indexName))
            {
                return(runner.GetItems(searchParam));
            }
        }
        public override List <SkinnyItem> GetItems(string databaseName,
                                                   string indexName,
                                                   string language,
                                                   string templateFilter,
                                                   bool searchBaseTemplates,
                                                   string locationFilter,
                                                   string fullTextQuery)
        {
            var searchParam = new NumericRangeSearchParam
            {
                Database            = databaseName,
                Ranges              = NumericRanges,
                LocationIds         = locationFilter,
                TemplateIds         = templateFilter,
                SearchBaseTemplates = searchBaseTemplates,
                FullTextQuery       = fullTextQuery,
                InnerCondition      = GetCondition(InnerNumericRangeConditionList),
                Language            = language
            };

            using (var runner = new QueryRunner(indexName))
            {
                return(runner.GetItems(searchParam));
            }
        }
Example #6
0
        public override List <SkinnyItem> GetItems(string databaseName,
                                                   string indexName,
                                                   string language,
                                                   string templateFilter,
                                                   bool searchBaseTemplates,
                                                   string locationFilter,
                                                   string fullTextQuery)
        {
            var baseCondition = GetCondition(this.BaseConditionList);
            var outerNumParamParamCondition = GetCondition(this.InnerNumericRangeConditionList);
            var outerDateParamCondition     = GetCondition(this.InnerDateRangeConditionList);
            var innerNumParamParamCondition = GetCondition(this.InnerNumericRangeConditionList);
            var innerDateParamCondition     = GetCondition(this.InnerDateRangeConditionList);

            var parameters = new List <SearchParam>
            {
                new SearchParam
                {
                    Database            = databaseName,
                    LocationIds         = locationFilter,
                    TemplateIds         = templateFilter,
                    SearchBaseTemplates = searchBaseTemplates,
                    FullTextQuery       = fullTextQuery,
                    Language            = language,
                    Condition           = baseCondition
                },
                new NumericRangeSearchParam
                {
                    Ranges         = this.NumericRanges,
                    InnerCondition =
                        innerNumParamParamCondition,
                    Condition =
                        outerNumParamParamCondition
                },
                new DateRangeSearchParam
                {
                    Ranges         = this.DateRanges,
                    InnerCondition =
                        innerDateParamCondition,
                    Condition = outerDateParamCondition
                }
            };

            using (var runner = new QueryRunner(indexName))
            {
                return(runner.GetItems(parameters));
            }
        }
Example #7
0
        public static List <SkinnyItem> GetSkinnyItems(string indexName, string templateFilter, bool searchBaseTemplates, string locationFilter, string fullTextQuery)
        {
            var searchParam = new SearchParam
            {
                Database            = Sitecore.Context.Database.Name,
                Language            = Sitecore.Context.Language.Name,
                TemplateIds         = templateFilter,
                LocationIds         = locationFilter,
                FullTextQuery       = fullTextQuery,
                SearchBaseTemplates = searchBaseTemplates
                                      //Condition = Sitecore.Search.QueryOccurance.Should,
                                      //RelatedIds
            };

            using (var runner = new QueryRunner(indexName))
            {
                return(runner.GetItems(searchParam));
            }
        }
        public override List <SkinnyItem> GetItems(string databaseName,
                                                   string indexName,
                                                   string language,
                                                   string templateFilter,
                                                   string locationFilter,
                                                   string fullTextQuery)
        {
            var baseCondition = GetCondition(BaseOccuranceList);
            var outerNumParamParamCondition = GetCondition(NumericRangeOccuranceList);
            var outerDateParamCondition     = GetCondition(DateRangeOccuranceList);
            var innerNumParamParamCondition = GetCondition(InnerNumericRangeOccuranceList);
            var innerDateParamCondition     = GetCondition(InnerDateRangeOccuranceList);

            var baseSearchParam = new SearchParam
            {
                Database      = databaseName,
                LocationIds   = locationFilter,
                TemplateIds   = templateFilter,
                FullTextQuery = fullTextQuery,
                Language      = language,
                Condition     = baseCondition
            };

            var numSearchParam = new NumericRangeSearchParam
            {
                Ranges         = NumericRanges,
                InnerCondition = innerNumParamParamCondition,
                Condition      = outerNumParamParamCondition
            };

            var dateSearchParam = new DateRangeSearchParam
            {
                Ranges         = DateRanges,
                InnerCondition = innerDateParamCondition,
                Condition      = outerDateParamCondition
            };

            using (var runner = new QueryRunner(indexName))
            {
                return(runner.GetItems(new[] { baseSearchParam, numSearchParam, dateSearchParam }));
            }
        }
Example #9
0
        public override List <SkinnyItem> GetItems(string databaseName,
                                                   string indexName,
                                                   string language,
                                                   string templateFilter,
                                                   string locationFilter,
                                                   string fullTextQuery)
        {
            var searchParam = new SearchParam
            {
                Database      = databaseName,
                Language      = language,
                TemplateIds   = templateFilter,
                LocationIds   = locationFilter,
                FullTextQuery = fullTextQuery
            };

            using (var runner = new QueryRunner(indexName))
            {
                return(runner.GetItems(searchParam, sortField: SortFieldName, reverse: Reverse));
            }
        }
Example #10
0
        public override List <SkinnyItem> GetItems(string databaseName,
                                                   string indexName,
                                                   string language,
                                                   string templateFilter,
                                                   bool searchBaseTemplates,
                                                   string locationFilter,
                                                   string fullTextQuery)
        {
            var searchParam1 = new SearchParam
            {
                Database            = databaseName,
                Language            = language,
                TemplateIds         = templateFilter,
                SearchBaseTemplates = searchBaseTemplates,
                LocationIds         = locationFilter,
                FullTextQuery       = fullTextQuery,
                Condition           = this.GetCondition(this.BaseConditionList)
            };

            var searchParam2 = new FieldSearchParam
            {
                FieldName  = this.Field1Name.Text,
                FieldValue = this.Field1Value.Text,
                Partial    = this.Partial1.Checked,
                Condition  = this.GetCondition(this.FieldSearchParameter1ConditionList)
            };

            var searchParam3 = new FieldSearchParam
            {
                FieldName  = this.Field2Name.Text,
                FieldValue = this.Field2Value.Text,
                Partial    = this.Partial2.Checked,
                Condition  = this.GetCondition(this.FieldSearchParameter2ConditionList)
            };

            using (var runner = new QueryRunner(indexName))
            {
                return(runner.GetItems(new [] { searchParam1, searchParam2, searchParam3 }));
            }
        }
        public override List <SkinnyItem> GetItems(string databaseName,
                                                   string indexName,
                                                   string language,
                                                   string templateFilter,
                                                   bool searchBaseTemplates,
                                                   string locationFilter,
                                                   string fullTextQuery)
        {
            var searchParam = new SearchParam
            {
                Database            = databaseName,
                Language            = language,
                RelatedIds          = RelationFilter,
                TemplateIds         = templateFilter,
                SearchBaseTemplates = searchBaseTemplates,
                LocationIds         = locationFilter,
                FullTextQuery       = fullTextQuery
            };

            using (var runner = new QueryRunner(indexName))
            {
                return(runner.GetItems(searchParam));
            }
        }
        public static List <SkinnyItem> GetItems(string indexName,
                                                 string language,
                                                 string templateFilter,
                                                 string locationFilter,
                                                 string fullTextQuery,
                                                 string relationFilter,
                                                 List <MultiFieldSearchParam.Refinement> refinements,
                                                 QueryOccurance occuranceTypeRefinements,
                                                 List <DateRangeSearchParam.DateRange> dateRanges,
                                                 QueryOccurance occuranceTypeDateRanges,
                                                 List <NumericRangeSearchParam.NumericRangeField> numRanges,
                                                 QueryOccurance occuranceTypeNumRanges,
                                                 string fieldName,
                                                 string fieldValue,
                                                 bool canBePartial,
                                                 bool performSort     = false,
                                                 string sortFieldName = "",
                                                 bool reverse         = false)
        {
            var searchParam = new SearchParam
            {
                Database      = "web",
                RelatedIds    = relationFilter,
                Language      = language,
                TemplateIds   = templateFilter,
                LocationIds   = locationFilter,
                FullTextQuery = fullTextQuery
            };

            var searchParamMultiField = new MultiFieldSearchParam
            {
                Refinements    = refinements,
                InnerCondition = occuranceTypeRefinements
            };

            var searchParamDate = new DateRangeSearchParam
            {
                Ranges         = dateRanges,
                InnerCondition = occuranceTypeDateRanges
            };

            var searchParamNum = new NumericRangeSearchParam
            {
                Ranges         = numRanges,
                InnerCondition = occuranceTypeNumRanges
            };

            var searchParamField = new FieldSearchParam
            {
                FieldName  = fieldName,
                FieldValue = fieldValue,
                Partial    = canBePartial
            };

            using (var runner = new QueryRunner(indexName))
            {
                if (performSort)
                {
                    return(runner.GetItems(new[] { searchParam, searchParamMultiField, searchParamDate, searchParamField, searchParamNum }, sortField: sortFieldName, reverse: reverse));
                }
                else
                {
                    return(runner.GetItems(new[] { searchParam, searchParamMultiField, searchParamDate, searchParamField, searchParamNum }));
                }
            }
        }