Esempio n. 1
0
        public override List<SkinnyItem> GetItems(string indexName,
            string language,
            string templateFilter,
            string locationFilter,
            string fullTextQuery)
        {
            var searchParam = new NumericRangeSearchParam
                              {
                                 Ranges = Ranges,
                                 LocationIds = locationFilter,
                                 TemplateIds = templateFilter,
                                 FullTextQuery = fullTextQuery,
                                 Occurance = QueryOccurance.Must,
                                 Language = language,
                                 ShowAllVersions = false
                              };

             using (var searcher = new Searcher(indexName))
             {
            return searcher.GetItemsInRange(searchParam);
             }
        }
Esempio n. 2
0
 protected void AddNumericRangeQuery(BooleanQuery query, NumericRangeSearchParam.NumericRangeField range, BooleanClause.Occur occurance)
 {
     var startTerm = new Term(range.FieldName, SearchHelper.FormatNumber(range.Start));
      var endTerm = new Term(range.FieldName, SearchHelper.FormatNumber(range.End));
      var rangeQuery = new RangeQuery(startTerm, endTerm, true);
      query.Add(rangeQuery, occurance);
 }
Esempio n. 3
0
        protected void ApplyNumericRangeSearchParam(BooleanQuery query, NumericRangeSearchParam param, BooleanClause.Occur innerOccurance)
        {
            if (param.Ranges.Count <= 0) return;

             foreach (var range in param.Ranges)
             {
            AddNumericRangeQuery(query, range, innerOccurance);
             }
        }
Esempio n. 4
0
        public virtual List<SkinnyItem> GetItemsInRange(NumericRangeSearchParam param)
        {
            var globalQuery = new CombinedQuery();

             ApplyLanguageClause(globalQuery, param.Language);
             ApplyTemplateFilter(globalQuery, param.TemplateIds);
             ApplyLocationFilter(globalQuery, param.LocationIds);
             ApplyFullTextClause(globalQuery, param.FullTextQuery);

             var translator = new QueryTranslator(Index);
             var booleanQuery = translator.ConvertCombinedQuery(globalQuery);
             var innerOccurance = translator.GetOccur(param.Occurance);

             ApplyNumericRangeSearchParam(booleanQuery, param, innerOccurance);

             return RunQuery(booleanQuery, param.ShowAllVersions);
        }