Exemplo n.º 1
0
        public SearchResults <TResult> Search <TResult>(SearchRequestBody requestBody, Action <SearchCommand> commandAction)
        {
            SearchCommand <TResult> searchCommand = this.commands.Search <TResult>();

            searchCommand.Body = requestBody.Clone();
            this.PrepareSerializerUsingConventions(searchCommand.CommandContext.Serializer);
            searchCommand.Indexes.Add((IndexName)this.DefaultIndex);
            if (commandAction.IsNotNull())
            {
                commandAction((SearchCommand)searchCommand);
            }
            return(new SearchResults <TResult>(searchCommand.Execute()));
        }
Exemplo n.º 2
0
        public SearchResults <TResult> SearchForType <TResult>(SearchRequestBody requestBody, Action <SearchCommand> commandAction)
        {
            SearchCommand <TResult> searchCommand = this.commands.Search <TResult>();

            searchCommand.Body = requestBody.Clone();
            this.Conventions.SearchTypeFilter((ITypeFilterable)searchCommand, (IEnumerable <Type>) new Type[1]
            {
                typeof(TResult)
            });
            this.PrepareSerializerUsingConventions(searchCommand.CommandContext.Serializer);
            searchCommand.Indexes.Add((IndexName)this.DefaultIndex);
            if (commandAction.IsNotNull())
            {
                commandAction((SearchCommand)searchCommand);
            }
            return(new SearchResults <TResult>(searchCommand.Execute()));
        }
Exemplo n.º 3
0
        public async Task <DataProfileResult[]> GetSearch(SearchRequestBody requestBody)
        {
            var request = new SearchRequest
            {
                Body = requestBody
            };

            var client = await Connect();

            var responseResult = (await client.SearchAsync(request))?.Body?.SearchResult;

            if (responseResult?.Length > 0)
            {
                ((IClientChannel)client).Close();
            }

            return(responseResult);
        }
 public Expression PreSearch(Expression selector, SearchRequestBody searchRequestBody, IClientConventions clientConventions, Language language)
 {
     return(ExpressionExtensions.Replace <MethodCallExpression>(ExpressionExtensions.Replace <MethodCallExpression>(selector, (Func <MethodCallExpression, bool>)(x =>
     {
         if (x.Method.Name == "AsHighlighted")
         {
             return x.Method.ReflectedType == typeof(XhtmlStringProjectionExtensions);
         }
         else
         {
             return false;
         }
     }), new Func <MethodCallExpression, Expression>(this.ReplaceAsHighlightedCall)), (Func <MethodCallExpression, bool>)(x =>
     {
         if (x.Method.Name == "AsCropped")
         {
             return x.Method.ReflectedType == typeof(XhtmlStringProjectionExtensions);
         }
         else
         {
             return false;
         }
     }), new Func <MethodCallExpression, Expression>(this.ReplaceAsCroppedCall)));
 }