public QueryResult <string> ExecuteQueryAndProject(SnQuery query, ServiceQueryContext queryContext)
 {
     using (var client = WcfServiceClient.GetSearchServiceContract())
     {
         return(client.ExecuteQueryAndProject(query, queryContext));
     }
 }
예제 #2
0
        public QueryResult <int> ExecuteQuery(SnQuery query, ServiceQueryContext queryContext)
        {
            var filter         = GetPermissionFilter(query, queryContext);
            var lucQuery       = Compile(query, null);
            var lucQueryResult = lucQuery.Execute(filter, null);
            var hits           = lucQueryResult?.Select(x => x.NodeId).ToArray() ?? new int[0];

            return(new QueryResult <int>(hits, lucQuery.TotalCount));
        }
예제 #3
0
        public QueryResult <string> ExecuteQueryAndProject(SnQuery query, ServiceQueryContext queryContext)
        {
            var filter         = GetPermissionFilter(query, queryContext);
            var lucQuery       = Compile(query, null);
            var projection     = query.Projection ?? IndexFieldName.NodeId;
            var lucQueryResult = lucQuery.Execute(filter, null);
            var hits           = lucQueryResult?
                                 .Select(x => x[projection, false])
                                 .Where(r => !string.IsNullOrEmpty(r))
                                 .ToArray()
                                 ?? new string[0];

            return(new QueryResult <string>(hits, lucQuery.TotalCount));
        }
예제 #4
0
        private static IPermissionFilter GetPermissionFilter(SnQuery query, ServiceQueryContext queryContext)
        {
            var security = new SecurityHandler(new ServiceSecurityContext(new SearchUser
            {
                Id            = queryContext.UserId,
                DynamicGroups = queryContext.DynamicGroups
            }, _securitySystem));

            if (!Enum.TryParse(queryContext.FieldLevel, true, out QueryFieldLevel queryFieldLevel))
            {
                queryFieldLevel = QueryFieldLevel.HeadOnly;
            }

            return(new ServicePermissionFilter(security, queryFieldLevel, query.AllVersions));
        }
예제 #5
0
 public QueryResult <string> ExecuteQueryAndProject(SnQuery query, ServiceQueryContext queryContext)
 {
     return(Channel.ExecuteQueryAndProject(query, queryContext));
 }
예제 #6
0
 public QueryResult <int> ExecuteQuery(SnQuery query, ServiceQueryContext queryContext)
 {
     return(Channel.ExecuteQuery(query, queryContext));
 }
 public QueryResult <string> ExecuteQueryAndProject(SnQuery query, ServiceQueryContext queryContext)
 {
     SnTrace.Index.Write("NullServiceClient.ExecuteQueryAndProject is not implemented.");
     return(QueryResult <string> .Empty);
 }
 public QueryResult <int> ExecuteQuery(SnQuery query, ServiceQueryContext queryContext)
 {
     SnTrace.Index.Write("NullServiceClient.ExecuteQuery is not implemented.");
     return(QueryResult <int> .Empty);
 }