Exemple #1
0
        protected override ObjectTypeDescriptor <dynamic, dynamic> Mapping <T>(ObjectTypeDescriptor <dynamic, dynamic> o)
        {
            var currentOptionType = typeof(T).ToString();

            // Check if rule is applied in linked types.
            // If true, do not apply all nested fields of this property
            if (currentOptionType.Equals(typeof(LinkedTypesOptions).ToString()))
            {
                return(o.Properties(pn => pn
                                    .UriKeyword()
                                    .EdgeKeyword()
                                    .ValueKeyword()
                                    ));
            }
            else
            {
                var nestedProperties = CollectProperties(Metadata.NestedMetadata);
                return(o.Properties(pn => pn
                                    .UriKeyword()
                                    .EdgeKeyword()
                                    .CustomNode(NodeNames.Value, od => od
                                                .Properties(pd => pd
                                                            .AddNestedFields(nestedProperties)
                                                            )
                                                )
                                    ));
            }
        }
 protected override ObjectTypeDescriptor <dynamic, dynamic> Mapping <T>(ObjectTypeDescriptor <dynamic, dynamic> o)
 {
     return(o
            .Properties(osp => osp
                        .ValueKeyword()
                        ));
 }
Exemple #3
0
        protected override ObjectTypeDescriptor <dynamic, dynamic> Mapping <T>(ObjectTypeDescriptor <dynamic, dynamic> o)
        {
            var metadataPropertyKey = Metadata.Key;

            return(o
                   .Properties(osp => osp
                               .UriKeyword()
                               .Keyword(ky =>
            {
                ky
                .Name(NodeNames.Value)
                .Fields(ff =>
                {
                    ff.DmpStandardEnglishAnalyzer();
                    ff.DmpNgramAnalyzer();

                    if (Metadata.Properties.ContainsKey(Strings.Taxonomy))
                    {
                        ff.DmpTaxonomyAnalyzer(metadataPropertyKey);
                        ff.DmpNgramTaxonomyAnalyzer(metadataPropertyKey);
                        ff.ExactTaxonomyAnalyzer(metadataPropertyKey);
                    }

                    return ff;
                });

                if (typeof(T) != typeof(LinkedTypesOptions))
                {
                    ky.CopyTo(cc => cc.Fields(Strings.DidYouMeanTrigram));
                }

                return ky;
            })
                               ));
        }
Exemple #4
0
        protected override ObjectTypeDescriptor <dynamic, dynamic> Mapping <T>(ObjectTypeDescriptor <dynamic, dynamic> o)
        {
            return(o
                   .Properties(osp => osp
                               .Keyword(ky =>
            {
                ky
                .Name(NodeNames.Value)
                .Fields(ff => ff
                        .DmpStandardEnglishAnalyzer()
                        .DmpNgramAnalyzer()
                        );

                if (typeof(T) != typeof(LinkedTypesOptions))
                {
                    ky.CopyTo(cc => cc
                              .Fields(
                                  Strings.DidYouMeanTrigram,
                                  Strings.AutoCompleteFilter,
                                  Strings.AutoCompleteTerms
                                  )
                              );
                }

                return ky;
            })
                               ));
        }
 protected override ObjectTypeDescriptor <dynamic, dynamic> Mapping <T>(ObjectTypeDescriptor <dynamic, dynamic> o)
 {
     return(o
            .Properties(osp => osp
                        .Date(ky => ky
                              .Name(NodeNames.Value)
                              )
                        ));
 }
Exemple #6
0
 public static ObjectTypeDescriptor <dynamic, dynamic> NestedNodeProperties(
     this ObjectTypeDescriptor <dynamic, dynamic> o)
 {
     return(o
            .Properties(op => op
                        .UriKeyword()
                        .Keyword(ky => ky.Name(NodeNames.Value)
                                 .Fields(ff => ff.DmpNgramAnalyzer().DmpStandardEnglishAnalyzer())
                                 )
                        ));
 }
 protected override ObjectTypeDescriptor <dynamic, dynamic> Mapping <T>(ObjectTypeDescriptor <dynamic, dynamic> o)
 {
     return(o
            .Properties(osp => osp
                        .UriKeyword()
                        .Keyword(ky =>
     {
         ky
         .Name(NodeNames.Value)
         .Fields(ff => ff
                 .DmpStandardEnglishAnalyzer()
                 );
         return ky;
     })
                        ));
 }
Exemple #8
0
        protected override ObjectTypeDescriptor <dynamic, dynamic> Mapping <T>(ObjectTypeDescriptor <dynamic, dynamic> o)
        {
            return(o
                   .Properties(osp => osp
                               .Keyword(ky =>
            {
                ky
                .Name(NodeNames.Value)
                .Normalizer("lowercase")
                .Fields(ff => ff
                        .DmpStandardEnglishAnalyzer()
                        .DmpNgramAnalyzer()
                        );

                if (typeof(T) != typeof(LinkedTypesOptions))
                {
                    ky.CopyTo(ct => ct.Fields(Strings.DidYouMeanTrigram));
                }

                return ky;
            })
                               ));
        }