private static PropertiesDescriptor<ErrorDocument> CreateMultiFieldsForAllStrings(PropertiesDescriptor<ErrorDocument> props)
 {
     var members = typeof(ErrorDocument)
         .GetProperties()
         .Where(x => x.PropertyType == typeof(string)
             && x.Name != "Id" //id field is obviously excluded
             && x.Name != "ErrorXml"//errorXML field is so long it has no indexer on it at all
             );
     foreach (var m in members)
     {
         var name = m.Name;
         name = Char.ToLowerInvariant(name[0]) + name.Substring(1);//lowercase the first character
         props
             .MultiField(mf => mf
                 .Name(name)
                 .Fields(pprops => pprops
                     .String(ps => ps.Name(name).Index(FieldIndexOption.Analyzed))
                     .String(ps => ps.Name(MultiFieldSuffix).Index(FieldIndexOption.NotAnalyzed))
                 )
             );
     }
     return props;
 }
Ejemplo n.º 2
0
 public static PropertiesDescriptor <dynamic> DmpNgramAnalyzer(this PropertiesDescriptor <dynamic> pd)
 {
     return(pd.Text(tt => tt.DmpNgramAnalyzer()));
 }
Ejemplo n.º 3
0
 private PropertiesDescriptor <TRoyal> RoyalProps <TRoyal>(PropertiesDescriptor <TRoyal> props) where TRoyal : class, IRoyal =>
 props.Keyword(s => s.Name(p => p.Name));
Ejemplo n.º 4
0
        public static PropertiesDescriptor <TProject> ProjectProperties <TProject>(PropertiesDescriptor <TProject> props)
            where TProject : Project
        {
            props
            .Join(j => j
                  .Name(n => n.Join)
                  .Relations(r => r
                             .Join <Project, CommitActivity>()
                             )
                  )
            .Keyword(d => d.Name(p => p.Type))
            .Keyword(s => s
                     .Name(p => p.Name)
                     .Store()
                     .Fields(fs => fs
                             .Text(ss => ss
                                   .Name("standard")
                                   .Analyzer("standard")
                                   )
                             .Completion(cm => cm
                                         .Name("suggest")
                                         )
                             )
                     )
            .Text(s => s
                  .Name(p => p.Description)
                  .Fielddata()
                  .Fields(f => f
                          .Text(t => t
                                .Name("shingle")
                                .Analyzer("shingle")
                                )
                          )
                  )
            .Date(d => d
                  .Store()
                  .Name(p => p.StartedOn)
                  )
            .Text(d => d
                  .Store()
                  .Name(p => p.DateString)
                  )
            .Keyword(d => d
                     .Name(p => p.State)
                     .Fields(fs => fs
                             .Text(st => st
                                   .Name("offsets")
                                   .IndexOptions(IndexOptions.Offsets)
                                   )
                             .Keyword(sk => sk
                                      .Name("keyword")
                                      )
                             )
                     )
            .Nested <Tag>(mo => mo
                          .AutoMap()
                          .Name(p => p.Tags)
                          .Properties(TagProperties)
                          )
            .Object <Developer>(o => o
                                .AutoMap()
                                .Name(p => p.LeadDeveloper)
                                .Properties(DeveloperProperties)
                                )
            .GeoPoint(g => g
                      .Name(p => p.LocationPoint)
                      )
            .GeoShape(g => g
                      .Name(p => p.LocationShape)
                      )
            .Shape(g => g
                   .Name(p => p.ArbitraryShape)
                   )
            .Completion(cm => cm
                        .Name(p => p.Suggest)
                        .Contexts(cx => cx
                                  .Category(c => c
                                            .Name("color")
                                            )
                                  .GeoLocation(c => c
                                               .Name("geo")
                                               .Precision(1)
                                               )
                                  )
                        )
            .Scalar(p => p.NumberOfCommits, n => n.Store())
            .Scalar(p => p.NumberOfContributors, n => n.Store())
            .Object <Dictionary <string, Metadata> >(o => o
                                                     .Name(p => p.Metadata)
                                                     )
            .RankFeature(rf => rf
                         .Name(p => p.Rank)
                         .PositiveScoreImpact()
                         );

            if (TestConfiguration.Instance.InRange(">=7.3.0"))
            {
                props.Flattened(f => f
                                .Name(p => p.Labels)
                                );
            }
            else
            {
                props.Object <Labels>(f => f
                                      .Name(p => p.Labels)
                                      .Enabled(false)
                                      );
            }

            if (TestConfiguration.Instance.InRange(">=7.7.0"))
            {
                props.ConstantKeyword(f => f
                                      .Name(p => p.VersionControl)
                                      );
            }
            else
            {
                props.Keyword(f => f
                              .Name(p => p.VersionControl)
                              );
            }

            return(props);
        }
Ejemplo n.º 5
0
 private static PropertiesDescriptor <DataDictionary> AddEnvironmentInfoMapping(this PropertiesDescriptor <DataDictionary> descriptor)
 {
     return(descriptor.Object <EnvironmentInfo>(f2 => f2.Name(Event.KnownDataKeys.EnvironmentInfo).Properties(p3 => p3
                                                                                                              .Text(f3 => f3.Name(r => r.IpAddress).CopyTo(fd => fd.Field(EventIndexType.Alias.IpAddress)).Index(false).IncludeInAll())
                                                                                                              .Text(f3 => f3.Name(r => r.MachineName).RootAlias(EventIndexType.Alias.MachineName).IncludeInAll().Boost(1.1).AddKeywordField())
                                                                                                              .Text(f3 => f3.Name(r => r.OSName).CopyTo(fd => fd.Field(EventIndexType.Alias.OperatingSystem)))
                                                                                                              .Text(f3 => f3.Name(r => r.CommandLine).RootAlias(EventIndexType.Alias.CommandLine))
                                                                                                              .Keyword(f3 => f3.Name(r => r.Architecture).RootAlias(EventIndexType.Alias.MachineArchitecture)))));
 }
Ejemplo n.º 6
0
 private static PropertiesDescriptor <DataDictionary> AddUserInfoMapping(this PropertiesDescriptor <DataDictionary> descriptor)
 {
     return(descriptor.Object <UserInfo>(f2 => f2.Name(Event.KnownDataKeys.UserInfo).Properties(p3 => p3
                                                                                                .Text(f3 => f3.Name(r => r.Identity).RootAlias(EventIndexType.Alias.User).Analyzer(EventIndex.EMAIL_ANALYZER).SearchAnalyzer(EventIndex.WHITESPACE_LOWERCASE_ANALYZER).IncludeInAll().Boost(1.1).AddKeywordField())
                                                                                                .Text(f3 => f3.Name(r => r.Name).RootAlias(EventIndexType.Alias.UserName).IncludeInAll().AddKeywordField()))));
 }
Ejemplo n.º 7
0
 public static PropertiesDescriptor <PercolatedQuery> PercolatedQueryProperties(PropertiesDescriptor <PercolatedQuery> props) => props
 .Percolator(pp => pp
             .Name(n => n.Query)
             );
Ejemplo n.º 8
0
		private static PropertiesDescriptor<Developer> DeveloperProperties(PropertiesDescriptor<Developer> props) => props
			.Keyword(s => s
				.Name(p => p.OnlineHandle)
			)
			.Keyword(s => s
				.Name(p => p.Gender)
			)
			.Text(s => s
				.Name(p => p.FirstName)
				.TermVector(TermVectorOption.WithPositionsOffsetsPayloads)
			)
			.Ip(s => s
				.Name(p => p.IPAddress)
			)
			.GeoPoint(g => g
				.Name(p => p.Location)
			)
			.Object<GeoIp>(o => o
				.Name(p => p.GeoIp)
			);
Ejemplo n.º 9
0
        public static IPromise <IProperties> SetInterpretedFields(PropertiesDescriptor <object> descriptor, PropertiesDescriptor <object> fieldsDescriptor, IEnumerable <string> segmentList)
        {
            var segment      = segmentList.First();
            var restSegments = segmentList.Skip(1);

            if (restSegments.Count() == 0)
            {
                descriptor.String(strDesc => strDesc
                                  .Name(segment)
                                  .Fields(f => fieldsDescriptor));
                return(descriptor);
            }

            descriptor.Object <object>(desc => desc
                                       .Name(segment)
                                       .Properties(pDesc => SetInterpretedFields(pDesc, fieldsDescriptor, restSegments)));

            return(descriptor);
        }
Ejemplo n.º 10
0
        public static IPromise <IProperties> MapProperties(JToken node, PropertiesDescriptor <object> descriptor, PropertiesDescriptor <object> analyzers, List <string> interpretedFields, string tagField, string path)
        {
            var properties = node.Children <JProperty>().ToList();

            foreach (JProperty property in properties)
            {
                var name          = property.Name;
                var fullPath      = path.AppendSeparator(".") + name;
                var isInterpreted = interpretedFields.Contains(fullPath, StringComparer.OrdinalIgnoreCase);
                Func <PropertiesDescriptor <object>, IPromise <IProperties> > applyAnalyzerFields = field => isInterpreted ? analyzers : field;
                var tokenPrefix = string.Empty;

                var type   = property.Value.SelectToken(SchemaHelper.Elements.Type)?.Value <string>();
                var format = property.Value.SelectToken(SchemaHelper.Elements.Format)?.Value <string>();

                if (string.IsNullOrEmpty(type))
                {
                    // Json schema validator should catch this
                    throw new ArgumentNullException($"Elastic type is not provided");
                }

                // Elastic nem kezel külön array-t, ezért ha így tartalmazza a schema az eleme típusát használjuk fel
                if (type == SchemaHelper.Types.Array)
                {
                    tokenPrefix = $"{SchemaHelper.Elements.Items}.";
                    type        = property.Value.SelectToken($"{tokenPrefix}{SchemaHelper.Elements.Type}")?.Value <string>();
                    format      = property.Value.SelectToken($"{tokenPrefix}{SchemaHelper.Elements.Format}")?.Value <string>();
                }

                switch (type)
                {
                case SchemaHelper.Types.String:
                {
                    if (tagField.Equals(fullPath, StringComparison.OrdinalIgnoreCase))
                    {
                        descriptor.String(desc => desc
                                          .Name(name)
                                          .Fields(applyAnalyzerFields)
                                          .Index(FieldIndexOption.NotAnalyzed));
                    }
                    else
                    {
                        descriptor.String(desc => desc
                                          .Name(name)
                                          .Fields(applyAnalyzerFields));
                    }
                    break;
                }

                case SchemaHelper.Types.Long:
                case SchemaHelper.Types.Integer:
                case SchemaHelper.Types.Short:
                case SchemaHelper.Types.Byte:
                case SchemaHelper.Types.Double:
                case SchemaHelper.Types.Float:
                {
                    var numberType = (NumberType)Enum.Parse(typeof(NumberType), type, true);
                    descriptor.Number(desc => desc
                                      .Name(name)
                                      .Type(numberType)
                                      .Fields(applyAnalyzerFields));
                    break;
                }

                case SchemaHelper.Types.Boolean:
                {
                    descriptor.Boolean(desc => desc
                                       .Name(name)
                                       .Fields(applyAnalyzerFields));
                    break;
                }

                case SchemaHelper.Types.Date:
                {
                    if (string.IsNullOrWhiteSpace(format))
                    {
                        format = "strict_date_optional_time||epoch_millis";
                    }

                    descriptor.Date(desc => desc
                                    .Name(name)
                                    .Format(format)
                                    .Fields(applyAnalyzerFields));
                }
                break;

                case SchemaHelper.Types.Attachment:
                {
                    descriptor.Attachment(desc => desc
                                          .Name(name)
                                          .FileField(d => d //ContentField
                                                     .Store(true)
                                                     .Fields(applyAnalyzerFields))
                                          .ContentTypeField(d => d.Store(true))
                                          .ContentLengthField(d => (d as NumberPropertyDescriptor <object>).Store(true))
                                          .LanguageField(d => (d as StringPropertyDescriptor <object>).Store(true))
                                          .KeywordsField(d => d.Store(true))
                                          .AuthorField(d => d.Store(true))
                                          .DateField(d => d.Store(true))
                                          .TitleField(d => d.Store(true))
                                          );
                    break;
                }

                case SchemaHelper.Types.Object:
                {
                    descriptor.Object <object>(desc => desc
                                               .Name(name)
                                               .Properties(propDesc =>
                                                           MapProperties(property.Value.SelectToken($"{tokenPrefix}{SchemaHelper.Elements.Properties}"),
                                                                         propDesc,
                                                                         analyzers,
                                                                         interpretedFields,
                                                                         tagField,
                                                                         fullPath)));
                    break;
                }

                default:
                {
                    throw new NotImplementedException($"Elastic type '{type}' is not implemented");
                }
                }
            }

            return(descriptor);
        }
Ejemplo n.º 11
0
        public static IPromise <IProperties> SetInterpretedFields(PropertiesDescriptor <object> descriptor, PropertiesDescriptor <object> fieldsDescriptor, string[][] segmentArray)
        {
            var levelSegments = GetLevelSegments(segmentArray, 0);
            var segmentGroups = levelSegments.GroupAdjacent(l => l).Select(g => new { Segment = g.Key, Count = g.Count() });

            foreach (var group in segmentGroups)
            {
                if (group.Count == 1)
                {
                    SetInterpretedFields(descriptor, fieldsDescriptor, segmentArray.First(s => s.First() == group.Segment));
                    continue;
                }

                var nseg = segmentArray.Where(s => s.FirstOrDefault() == group.Segment)
                           .Select(x => x.Skip(1).ToArray())
                           .ToArray();
                descriptor.Object <object>(s => s
                                           .Name(group.Segment)
                                           .Properties(pDesc => SetInterpretedFields(pDesc, fieldsDescriptor, nseg)));
            }

            return(descriptor);
        }
Ejemplo n.º 12
0
        public static IPromise <IProperties> MapProperties(JToken node, PropertiesDescriptor <object> descriptor, PropertiesDescriptor <object> analyzers, List <string> interpretedFields, string tagField)
        {
            if (node.Type != JTokenType.Object)
            {
                return(descriptor);
            }

            var properties = node.Children <JProperty>().ToList();

            if (node.Parent == null)
            {
                // Process root object
                var type = properties.FirstOrDefault(c => c.Name == SchemaHelper.Elements.Type)?.Value.Value <string>();
                if (type == SchemaHelper.Types.Object)
                {
                    var propertiesProperty = properties.FirstOrDefault(c => c.Name == SchemaHelper.Elements.Properties).Value;
                    return(MapProperties(propertiesProperty, descriptor, analyzers, interpretedFields, tagField, string.Empty));
                }
            }

            return(descriptor);
        }
Ejemplo n.º 13
0
 public static PropertiesDescriptor <Project> ProjectProperties(PropertiesDescriptor <Project> props) => props
 .Keyword(s => s
          .Name(p => p.Name)
          .Store()
          .Fields(fs => fs
                  .Text(ss => ss
                        .Name("standard")
                        .Analyzer("standard")
                        )
                  .Completion(cm => cm
                              .Name("suggest")
                              )
                  )
          )
 .Text(s => s
       .Name(p => p.Description)
       .Fielddata()
       )
 .Date(d => d
       .Store()
       .Name(p => p.StartedOn)
       )
 .Text(d => d
       .Store()
       .Name(p => p.DateString)
       )
 .Keyword(d => d
          .Name(p => p.State)
          .Fields(fs => fs
                  .Text(st => st
                        .Name("offsets")
                        .IndexOptions(IndexOptions.Offsets)
                        )
                  )
          )
 .Nested <Tag>(mo => mo
               .AutoMap()
               .Name(p => p.Tags)
               .Properties(TagProperties)
               )
 .Object <Developer>(o => o
                     .AutoMap()
                     .Name(p => p.LeadDeveloper)
                     .Properties(DeveloperProperties)
                     )
 .GeoPoint(g => g
           .Name(p => p.Location)
           )
 .Completion(cm => cm
             .Name(p => p.Suggest)
             .Contexts(cx => cx
                       .Category(c => c
                                 .Name("color")
                                 )
                       )
             )
 .Number(n => n
         .Name(p => p.NumberOfCommits)
         .Store()
         )
 .Object <Dictionary <string, Metadata> >(o => o
                                          .Name(p => p.Metadata)
                                          );
Ejemplo n.º 14
0
		private static PropertiesDescriptor<Tag> TagProperties(PropertiesDescriptor<Tag> props) => props
			.String(s => s
				.Name(p => p.Name).NotAnalyzed()
				.Fields(f => f
					.String(st => st.Name("vectors").TermVector(TermVectorOption.WithPositionsOffsetsPayloads))
				)
			);
Ejemplo n.º 15
0
 private PropertiesDescriptor <TRoyal> RoyalProps <TRoyal>(PropertiesDescriptor <TRoyal> props) where TRoyal : class, IRoyal =>
 props.String(s => s.Name(p => p.Name).NotAnalyzed());
Ejemplo n.º 16
0
		public static PropertiesDescriptor<Project> ProjectProperties(PropertiesDescriptor<Project> props) => props
				.Keyword(s => s
					.Name(p => p.Name)
					.Store()
					.Fields(fs => fs
						.Text(ss => ss
							.Name("standard")
							.Analyzer("standard")
						)
						.Completion(cm => cm
							.Name("suggest")
						)
					)
				)
				.Text(s=>s
					.Name(p=>p.Description)
					.Fielddata()
				)
				.Date(d => d
					.Store()
					.Name(p => p.StartedOn)
				)
				.Text(d => d
					.Store()
					.Name(p => p.DateString)
				)
				.Keyword(d => d
					.Name(p => p.State)
					.Fields(fs => fs
						.Text(st => st
							.Name("offsets")
							.IndexOptions(IndexOptions.Offsets)
						)
					)
				)
				.Nested<Tag>(mo => mo
					.AutoMap()
					.Name(p => p.Tags)
					.Properties(TagProperties)
				)
				.Object<Developer>(o => o
					.AutoMap()
					.Name(p => p.LeadDeveloper)
					.Properties(DeveloperProperties)
				)
				.GeoPoint(g => g
					.Name(p => p.Location)
				)
				.Completion(cm => cm
					.Name(p => p.Suggest)
					.Contexts(cx => cx
						.Category(c => c
							.Name("color")
						)
					)
				)
				.Number(n => n
					.Name(p => p.NumberOfCommits)
					.Store()
				)
				.Object<Dictionary<string,Metadata>>(o => o
					.Name(p => p.Metadata)
				);
Ejemplo n.º 17
0
 public static PropertiesDescriptor <DataDictionary> AddUserDescriptionMapping(this PropertiesDescriptor <DataDictionary> descriptor)
 {
     return(descriptor.Object <UserDescription>(f2 => f2.Name(Event.KnownDataKeys.UserDescription).Properties(p3 => p3
                                                                                                              .Text(f3 => f3.Name(r => r.Description))
                                                                                                              .Text(f3 => f3.Name(r => r.EmailAddress).Analyzer(EventIndex.EMAIL_ANALYZER).SearchAnalyzer("simple").Boost(1.1).AddKeywordField().CopyTo(f4 => f4.Field($"data.{Event.KnownDataKeys.UserInfo}.identity"))))));
 }
Ejemplo n.º 18
0
 /// <summary>
 /// This field is added to allow to find taxonomies terms and partial matching ones in the exaxt search of the term in the query string query.
 /// </summary>
 /// <param name="pd"></param>
 /// <param name="metadataPropertyKey"></param>
 /// <returns></returns>
 public static PropertiesDescriptor <dynamic> ExactTaxonomyAnalyzer(this PropertiesDescriptor <dynamic> pd, string metadataPropertyKey)
 {
     return(pd.Text(ft =>
                    ft.Name("ExactTaxo" + Strings.Taxonomy).Analyzer(metadataPropertyKey.GetPreparedAnalyzerName(ElasticAnalyzers.TaxonomyTextPrefix) + "_exact_taxo")
                    .SearchAnalyzer("keyword")));
 }
Ejemplo n.º 19
0
 private static PropertiesDescriptor <DataDictionary> AddSubmissionClientMapping(this PropertiesDescriptor <DataDictionary> descriptor)
 {
     return(descriptor.Object <SubmissionClient>(f2 => f2.Name(Event.KnownDataKeys.SubmissionClient).Properties(p3 => p3
                                                                                                                .Text(f3 => f3.Name(r => r.IpAddress).CopyTo(fd => fd.Field(EventIndexType.Alias.IpAddress)).Index(false).IncludeInAll())
                                                                                                                .Text(f3 => f3.Name(r => r.UserAgent).RootAlias(EventIndexType.Alias.ClientUserAgent).AddKeywordField())
                                                                                                                .Text(f3 => f3.Name(r => r.Version).RootAlias(EventIndexType.Alias.ClientVersion).AddKeywordField()))));
 }
Ejemplo n.º 20
0
 private static PropertiesDescriptor <DataDictionary> AddUserDescriptionMapping(this PropertiesDescriptor <DataDictionary> descriptor)
 {
     return(descriptor.Object <UserDescription>(f2 => f2.Name(Event.KnownDataKeys.UserDescription).Properties(p3 => p3
                                                                                                              .Text(f3 => f3.Name(r => r.Description).RootAlias(EventIndexType.Alias.UserDescription).IncludeInAll())
                                                                                                              .Text(f3 => f3.Name(r => r.EmailAddress).RootAlias(EventIndexType.Alias.UserEmail).Analyzer(EventIndex.EMAIL_ANALYZER).SearchAnalyzer("simple").IncludeInAll().Boost(1.1).AddKeywordField()))));
 }
Ejemplo n.º 21
0
 public static PropertiesDescriptor <PersistentEvent> AddDataDictionaryAliases(this PropertiesDescriptor <PersistentEvent> descriptor)
 {
     return(descriptor
            .FieldAlias(a => a.Name(EventIndex.Alias.Version).Path(f => (string)f.Data[Event.KnownDataKeys.Version]))
            .FieldAlias(a => a.Name(EventIndex.Alias.Level).Path(f => (string)f.Data[Event.KnownDataKeys.Level]))
            .FieldAlias(a => a.Name(EventIndex.Alias.SubmissionMethod).Path(f => (string)f.Data[Event.KnownDataKeys.SubmissionMethod]))
            .FieldAlias(a => a.Name(EventIndex.Alias.ClientUserAgent).Path(f => ((SubmissionClient)f.Data[Event.KnownDataKeys.SubmissionClient]).UserAgent))
            .FieldAlias(a => a.Name(EventIndex.Alias.ClientVersion).Path(f => ((SubmissionClient)f.Data[Event.KnownDataKeys.SubmissionClient]).Version))
            .FieldAlias(a => a.Name(EventIndex.Alias.LocationCountry).Path(f => ((Location)f.Data[Event.KnownDataKeys.Location]).Country))
            .FieldAlias(a => a.Name(EventIndex.Alias.LocationLevel1).Path(f => ((Location)f.Data[Event.KnownDataKeys.Location]).Level1))
            .FieldAlias(a => a.Name(EventIndex.Alias.LocationLevel2).Path(f => ((Location)f.Data[Event.KnownDataKeys.Location]).Level2))
            .FieldAlias(a => a.Name(EventIndex.Alias.LocationLocality).Path(f => ((Location)f.Data[Event.KnownDataKeys.Location]).Locality))
            .FieldAlias(a => a.Name(EventIndex.Alias.Browser).Path(f => ((RequestInfo)f.Data[Event.KnownDataKeys.RequestInfo]).Data[RequestInfo.KnownDataKeys.Browser]))
            .FieldAlias(a => a.Name(EventIndex.Alias.Device).Path(f => ((RequestInfo)f.Data[Event.KnownDataKeys.RequestInfo]).Data[RequestInfo.KnownDataKeys.Device]))
            .FieldAlias(a => a.Name(EventIndex.Alias.RequestIsBot).Path(f => ((RequestInfo)f.Data[Event.KnownDataKeys.RequestInfo]).Data[RequestInfo.KnownDataKeys.IsBot]))
            .FieldAlias(a => a.Name(EventIndex.Alias.RequestPath).Path(f => ((RequestInfo)f.Data[Event.KnownDataKeys.RequestInfo]).Path))
            .FieldAlias(a => a.Name(EventIndex.Alias.RequestUserAgent).Path(f => ((RequestInfo)f.Data[Event.KnownDataKeys.RequestInfo]).UserAgent))
            .FieldAlias(a => a.Name(EventIndex.Alias.CommandLine).Path(f => ((EnvironmentInfo)f.Data[Event.KnownDataKeys.EnvironmentInfo]).CommandLine))
            .FieldAlias(a => a.Name(EventIndex.Alias.MachineArchitecture).Path(f => ((EnvironmentInfo)f.Data[Event.KnownDataKeys.EnvironmentInfo]).Architecture))
            .FieldAlias(a => a.Name(EventIndex.Alias.MachineName).Path(f => ((EnvironmentInfo)f.Data[Event.KnownDataKeys.EnvironmentInfo]).MachineName)));
 }
Ejemplo n.º 22
0
 public MappingOperationEventArgs(PropertiesDescriptor <Document> descriptor)
 {
     this.descriptor = descriptor;
 }
Ejemplo n.º 23
0
 public static PropertiesDescriptor <DataDictionary> AddLevelMapping(this PropertiesDescriptor <DataDictionary> descriptor)
 {
     return(descriptor.Text(f2 => f2.Name(Event.KnownDataKeys.Level).Analyzer(EventIndex.LOWER_KEYWORD_ANALYZER).AddKeywordField()));
 }
Ejemplo n.º 24
0
 public static PropertiesDescriptor <TProject> ProjectProperties <TProject>(PropertiesDescriptor <TProject> props)
     where TProject : Project => props
 .Join(j => j
       .Name(n => n.Join)
       .Relations(r => r
                  .Join <Project, CommitActivity>()
                  )
       )
 .Keyword(d => d.Name(p => p.Type))
 .Keyword(s => s
          .Name(p => p.Name)
          .Store()
          .Fields(fs => fs
                  .Text(ss => ss
                        .Name("standard")
                        .Analyzer("standard")
                        )
                  .Completion(cm => cm
                              .Name("suggest")
                              )
                  )
          )
 .Text(s => s
       .Name(p => p.Description)
       .Fielddata()
       .Fields(f => f
               .Text(t => t
                     .Name("shingle")
                     .Analyzer("shingle")
                     )
               )
       )
 .Date(d => d
       .Store()
       .Name(p => p.StartedOn)
       )
 .Text(d => d
       .Store()
       .Name(p => p.DateString)
       )
 .Keyword(d => d
          .Name(p => p.State)
          .Fields(fs => fs
                  .Text(st => st
                        .Name("offsets")
                        .IndexOptions(IndexOptions.Offsets)
                        )
                  .Keyword(sk => sk
                           .Name("keyword")
                           )
                  )
          )
 .Nested <Tag>(mo => mo
               .AutoMap()
               .Name(p => p.Tags)
               .Properties(TagProperties)
               )
 .Object <Developer>(o => o
                     .AutoMap()
                     .Name(p => p.LeadDeveloper)
                     .Properties(DeveloperProperties)
                     )
 .GeoPoint(g => g
           .Name(p => p.Location)
           )
 .Completion(cm => cm
             .Name(p => p.Suggest)
             .Contexts(cx => cx
                       .Category(c => c
                                 .Name("color")
                                 )
                       )
             )
 .Scalar(p => p.NumberOfCommits, n => n.Store())
 .Scalar(p => p.NumberOfContributors, n => n.Store())
 .Object <Dictionary <string, Metadata> >(o => o
                                          .Name(p => p.Metadata)
                                          );
Ejemplo n.º 25
0
 public static PropertiesDescriptor <DataDictionary> AddSubmissionMethodMapping(this PropertiesDescriptor <DataDictionary> descriptor)
 {
     return(descriptor.Keyword(f2 => f2.Name(Event.KnownDataKeys.SubmissionMethod).IgnoreAbove(1024)));
 }
Ejemplo n.º 26
0
 public static PropertiesDescriptor <ProjectPercolation> PercolatedQueryProperties(PropertiesDescriptor <ProjectPercolation> props) =>
 ProjectProperties(props.Percolator(pp => pp.Name(n => n.Query)));
Ejemplo n.º 27
0
 public static PropertiesDescriptor <DataDictionary> AddSubmissionClientMapping(this PropertiesDescriptor <DataDictionary> descriptor)
 {
     return(descriptor.Object <SubmissionClient>(f2 => f2.Name(Event.KnownDataKeys.SubmissionClient).Properties(p3 => p3
                                                                                                                .Text(f3 => f3.Name(r => r.IpAddress).Analyzer(EventIndex.COMMA_WHITESPACE_ANALYZER).CopyTo(fd => fd.Fields(EventIndex.Alias.IpAddress)))
                                                                                                                .Text(f3 => f3.Name(r => r.UserAgent).Analyzer(EventIndex.LOWER_KEYWORD_ANALYZER).AddKeywordField())
                                                                                                                .Keyword(f3 => f3.Name(r => r.Version).IgnoreAbove(1024)))));
 }
Ejemplo n.º 28
0
 public static PropertiesDescriptor <dynamic> EdgeKeyword(this PropertiesDescriptor <dynamic> pd)
 {
     return(pd.Keyword(kk => kk.Name(NodeNames.Edge)));
 }
Ejemplo n.º 29
0
 public static PropertiesDescriptor <DataDictionary> AddEnvironmentInfoMapping(this PropertiesDescriptor <DataDictionary> descriptor)
 {
     return(descriptor.Object <EnvironmentInfo>(f2 => f2.Name(Event.KnownDataKeys.EnvironmentInfo).Properties(p3 => p3
                                                                                                              .Text(f3 => f3.Name(r => r.IpAddress).Analyzer(EventIndex.COMMA_WHITESPACE_ANALYZER).CopyTo(fd => fd.Fields(EventIndex.Alias.IpAddress)))
                                                                                                              .Text(f3 => f3.Name(r => r.MachineName).Analyzer(EventIndex.LOWER_KEYWORD_ANALYZER).AddKeywordField().Boost(1.1))
                                                                                                              .Text(f3 => f3.Name(r => r.OSName).Analyzer(EventIndex.WHITESPACE_LOWERCASE_ANALYZER).AddKeywordField().CopyTo(fd => fd.Field(EventIndex.Alias.OperatingSystem)))
                                                                                                              .Keyword(f3 => f3.Name(r => r.CommandLine).IgnoreAbove(1024))
                                                                                                              .Keyword(f3 => f3.Name(r => r.Architecture).IgnoreAbove(1024)))));
 }
Ejemplo n.º 30
0
 public static PropertiesDescriptor <dynamic> DmpStandardEnglishAnalyzer(this PropertiesDescriptor <dynamic> pd)
 {
     return(pd.Text(tt => tt.DmpStandardEnglishAnalyzer()));
 }
Ejemplo n.º 31
0
 public static PropertiesDescriptor <PersistentEvent> AddDataDictionaryMappings(this PropertiesDescriptor <PersistentEvent> descriptor)
 {
     return(descriptor.Object <DataDictionary>(f => f.Name(e => e.Data).Properties(p2 => p2
                                                                                   .AddVersionMapping()
                                                                                   .AddLevelMapping()
                                                                                   .AddSubmissionMethodMapping()
                                                                                   .AddLocationMapping()
                                                                                   .AddRequestInfoMapping()
                                                                                   .AddErrorMapping()
                                                                                   .AddSimpleErrorMapping()
                                                                                   .AddEnvironmentInfoMapping()
                                                                                   .AddUserDescriptionMapping()
                                                                                   .AddUserInfoMapping())));
 }
Ejemplo n.º 32
0
		private static PropertiesDescriptor<Developer> DeveloperProperties(PropertiesDescriptor<Developer> props) => props
			.String(s => s.Name(p => p.OnlineHandle).NotAnalyzed())
			.String(s => s.Name(p => p.Gender).NotAnalyzed())
			.String(s => s.Name(p => p.FirstName).TermVector(TermVectorOption.WithPositionsOffsetsPayloads))
			.Ip(s => s.Name(p => p.IPAddress))
			.GeoPoint(g => g.Name(p => p.Location).LatLon())
			;
Ejemplo n.º 33
0
 private static PropertiesDescriptor <DataDictionary> AddVersionMapping(this PropertiesDescriptor <DataDictionary> descriptor)
 {
     return(descriptor.Text(f2 => f2.Name(Event.KnownDataKeys.Version).RootAlias(EventIndexType.Alias.Version).Analyzer(EventIndex.VERSION_INDEX_ANALYZER).SearchAnalyzer(EventIndex.VERSION_SEARCH_ANALYZER).AddKeywordField()));
 }
Ejemplo n.º 34
0
		private static PropertiesDescriptor<Tag> TagProperties(PropertiesDescriptor<Tag> props) => props
			.Keyword(s => s
				.Name(p => p.Name)
				.Fields(f => f
					.Text(st => st
						.Name("vectors")
						.TermVector(TermVectorOption.WithPositionsOffsetsPayloads)
					)
				)
			);
Ejemplo n.º 35
0
 private static PropertiesDescriptor <DataDictionary> AddSubmissionMethodMapping(this PropertiesDescriptor <DataDictionary> descriptor)
 {
     return(descriptor.Text(f2 => f2.Name(Event.KnownDataKeys.SubmissionMethod).RootAlias(EventIndexType.Alias.SubmissionMethod).AddKeywordField()));
 }
Ejemplo n.º 36
0
		public static PropertiesDescriptor<PercolatedQuery> PercolatedQueryProperties(PropertiesDescriptor<PercolatedQuery> props) => props
			.Percolator(pp => pp
				.Name(n => n.Query)
			);
Ejemplo n.º 37
0
 public static PropertiesDescriptor <dynamic> DmpNgramTaxonomyAnalyzer(this PropertiesDescriptor <dynamic> pd, string metadataPropertyKey)
 {
     return(pd.Text(ft =>
                    ft.Name("Ngram" + Strings.Taxonomy).Analyzer(metadataPropertyKey.GetPreparedAnalyzerName(ElasticAnalyzers.TaxonomyTextPrefix) + "_ngram")
                    .SearchAnalyzer(metadataPropertyKey.GetPreparedAnalyzerName(ElasticAnalyzers.TaxonomyTextSearchPrefix))));
 }