public SimpleQueryStringQueryDescriptor <T> OnFieldsWithBoost(Action <FluentDictionary <string, double?> > boostableSelector)
        {
            var d = new FluentDictionary <string, double?>();

            boostableSelector(d);
            ((ISimpleQueryStringQuery)this).Fields = d.Select(o => PropertyPathMarker.Create(o.Key, o.Value));
            return(this);
        }
Beispiel #2
0
 private void Write(string queryType, PropertyPathMarker fieldName = null)
 {
     this.Write(queryType, fieldName == null
                         ? null
                         : new Dictionary <string, string> {
         { "field", this._infer.PropertyPath(fieldName) }
     });
 }
        public MultiMatchQueryDescriptor <T> OnFieldsWithBoost(Action <FluentDictionary <Expression <Func <T, object> >, double?> > boostableSelector)
        {
            var d = new FluentDictionary <Expression <Func <T, object> >, double?>();

            boostableSelector(d);
            ((IMultiMatchQuery)this).Fields = d.Select(o => PropertyPathMarker.Create(o.Key, o.Value));
            return(this);
        }
        private FilterContainer _GeoPolygon(PropertyPathMarker fieldName, string[] points)
        {
            IGeoPolygonFilter filter = new GeoPolygonFilterDescriptor();

            filter.Points = points;
            filter.Field  = fieldName;
            return(this.New(filter, f => f.GeoPolygon = filter));
        }
        private FilterContainer _GeoIndexedShape(PropertyPathMarker field, Action <GeoIndexedShapeFilterDescriptor> filterDescriptor)
        {
            var filter = new GeoIndexedShapeFilterDescriptor();

            if (filterDescriptor != null)
            {
                filterDescriptor(filter);
            }
            ((IGeoIndexedShapeFilter)filter).Field = field;
            return(this.New(filter, f => f.GeoShape = filter));
        }
Beispiel #6
0
 private TermsLookupFilterDescriptor _Lookup <T>(PropertyPathMarker field, string id, string index, string type)
 {
     ((ITermsLookupFilter)this).Path = field;
     ((ITermsLookupFilter)this).Id   = id;
     ((ITermsLookupFilter)this).Type = type ?? new TypeNameMarker {
         Type = typeof(T)
     };
     ((ITermsLookupFilter)this).Index = index ?? new IndexNameMarker {
         Type = typeof(T)
     };
     return(this);
 }
        public void PropertyPathMarkerEqualsDoesNotUseHashCode()
        {
            var collision = GetHashCollison();

            var propertyMarker1 = new PropertyPathMarker {
                Name = collision.Item1
            };
            var propertyMarker2 = new PropertyPathMarker {
                Name = collision.Item2
            };

            this.TestAddingToDictionary(propertyMarker1, propertyMarker2);
        }
        private FilterContainer _GeoDistanceRange(PropertyPathMarker field, Action <GeoDistanceRangeFilterDescriptor> filterDescriptor)
        {
            var filter = new GeoDistanceRangeFilterDescriptor();

            if (filterDescriptor != null)
            {
                filterDescriptor(filter);
            }

            IGeoDistanceRangeFilter ff = filter;

            ff.Field = field;
            return(this.New(ff, f => f.GeoDistanceRange = ff));
        }
Beispiel #9
0
 private GeoIndexedShapeFilterDescriptor _SetShape <T>(PropertyPathMarker field, string id, string index, string type)
 {
     ((IGeoIndexedShapeFilter)this).IndexedShape = new IndexedGeoShape
     {
         Field = field,
         Id    = id,
         Type  = type ?? new TypeNameMarker {
             Type = typeof(T)
         },
         Index = index ?? new IndexNameMarker {
             Type = typeof(T)
         }
     };
     return(this);
 }
        public string PropertyPath(PropertyPathMarker marker)
        {
            if (marker.IsConditionless())
            {
                return(null);
            }
            var name = !marker.Name.IsNullOrEmpty() ? marker.Name : this.PropertyNameResolver.Resolve(marker.Type);

            if (marker.Boost.HasValue)
            {
                name += "^" + marker.Boost.Value.ToString(CultureInfo.InvariantCulture);
            }

            return(name);
        }
 private void Write(string queryType, PropertyPathMarker fieldName = null)
 {
     this.Write(queryType, fieldName == null
         ? null
         : new Dictionary<string, string> {{"field", this._infer.PropertyPath(fieldName)}});
 }
Beispiel #12
0
 /// <summary>
 /// Create a strongly typed string representation of the path to a property
 /// <para>i.e p => p.Arrary.First().SubProperty.Field will return 'array.subProperty.field'</para>
 /// </summary>
 /// <typeparam name="T">The type of the object</typeparam>
 /// <param name="path">The path we want to specify</param>
 /// <param name="boost">An optional ^boost postfix, only make sense with queries</param>
 public static PropertyPathMarker Path <T>(Expression <Func <T, object> > path, double?boost = null)
     where T : class
 {
     return(PropertyPathMarker.Create(path, boost));
 }