public override void ApplyConventions(IClientConventions clientConventions)
 {
     base.ApplyConventions(clientConventions);
     ContentIndexer.Instance.Conventions.ForInstancesOf <GenericVariant>().ShouldIndex(x => false);
     SearchClient.Instance.Conventions.ForInstancesOf <GenericProduct>().IncludeField(x => x.AvailableSizes());
     SearchClient.Instance.Conventions.ForInstancesOf <GenericProduct>().IncludeField(x => x.AvailableColors());
     SearchClient.Instance.Conventions.NestedConventions.ForInstancesOf <GenericProduct>().Add(v => v.VariationModels());
 }
Beispiel #2
0
        public Filter ParseFilter(Expression <Func <T, bool> > expression, IClientConventions conventions)
        {
            this.conventions = conventions;
            Filter filterToReturn = null;

            addStack.Push(filter => filterToReturn = filter);
            Visit(expression);
            return(filterToReturn);
        }
 public override void ApplyConventions(IClientConventions clientConventions)
 {
     try
     {
         base.ApplyConventions(clientConventions);
         // Uncomment line below if we don't index VariationContent
         // ContentIndexer.Instance.Conventions.ForInstancesOf<VariationContent>().ShouldIndex(x => false);
         SearchClient.Instance.Conventions.NestedConventions.ForInstancesOf <ProductContent>()
         .Add(x => x.VariationContents());
     }
     catch (Exception ex)
     {
     }
 }
Beispiel #4
0
 public static void AddNestedConventions(this IClientConventions conventions)
 {
     conventions.ContractResolver.ObjectContractInterceptors.Add(new IncludeTypeNameInNestedListFieldNamesInterceptor());
     conventions.FieldNameConvention = new NestedFieldNameConvention();
 }
 public Expression PostSearch(Expression executable, SearchHit <JObject> searchHit, IClientConventions clientConventions, Language language)
 {
     return(ExpressionExtensions.Replace <MethodCallExpression>(ExpressionExtensions.Replace <MethodCallExpression>(executable, (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)));
 }
 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)));
 }
 public static void AddDictionaryConventions(this IClientConventions conventions)
 {
     conventions.ContractResolver.ContractInterceptors.Add(new DictionaryInterceptor());
 }