예제 #1
0
        public override BooleanQuery ProcessQuery(QueryOccurance outerCondition, Index index)
        {
            var outerQuery = new BooleanQuery();

             var translator = new QueryTranslator(index);
             var innerOccurance = translator.GetOccur(InnerCondition);
             var outerOccurance = translator.GetOccur(outerCondition);

             var baseQuery = base.ProcessQuery(outerCondition, index);
             if (baseQuery != null && baseQuery.Clauses().Count > 0) outerQuery.Add(baseQuery, outerOccurance);

             var dateRangeQuery = ApplyDateRangeSearchParam(innerOccurance);

             if (dateRangeQuery != null) outerQuery.Add(dateRangeQuery, outerOccurance);

             return outerQuery;
        }
예제 #2
0
        public virtual List<SkinnyItem> GetItems(IEnumerable<SearchParam> parameters, bool showAllVersions = false, string sortField = "", bool reverse = true, int start = 0, int end = 0)
        {
            Assert.IsNotNull(Index, "Index");

             var translator = new QueryTranslator(Index);
             var query = new BooleanQuery();

             foreach (var parameter in parameters.Where(p => p != null))
             {
            var innerQueryResult = parameter.ProcessQuery(parameter.Condition, Index);
            if (innerQueryResult.GetClauses().Length > 0)
            {
               var clause = new BooleanClause(innerQueryResult, translator.GetOccur(parameter.Condition));
               query.Add(clause);
            }
             }

             return RunQuery(query, showAllVersions, sortField, reverse, start, end);
        }
예제 #3
0
        public override BooleanQuery ProcessQuery(QueryOccurance occurance, Index index)
        {
            var outerQuery = new BooleanQuery();

             var refinementQuery = ApplyRefinements(Refinements, InnerCondition);

             var translator = new QueryTranslator(index);
             var refBooleanQuery = translator.ConvertCombinedQuery(refinementQuery);
             var outerOccurance = translator.GetOccur(occurance);

             if (refBooleanQuery != null && refBooleanQuery.Clauses().Count > 0)
            outerQuery.Add(refBooleanQuery, outerOccurance);

             var baseQuery = base.ProcessQuery(occurance, index);
             if (baseQuery != null)
            outerQuery.Add(baseQuery, outerOccurance);

             return outerQuery;
        }
예제 #4
0
        public virtual BooleanQuery ProcessQuery(QueryOccurance occurance, Index index)
        {
            var innerQuery = new CombinedQuery();
            ApplyFullTextClause(innerQuery, FullTextQuery, occurance);
            ApplyRelationFilter(innerQuery, RelatedIds, occurance);
            ApplyTemplateFilter(innerQuery, TemplateIds, occurance);
            ApplyLocationFilter(innerQuery, LocationIds, occurance);
            AddFieldValueClause(innerQuery, BuiltinFields.Database, Database, occurance);

            if (innerQuery.Clauses.Count < 1)
                return null;

            var translator = new QueryTranslator(index);
            var booleanQuery = translator.ConvertCombinedQuery(innerQuery);

            ApplyLanguageClause(booleanQuery, Language, translator.GetOccur(occurance));

            return booleanQuery;
        }