Exemplo n.º 1
0
        /// <summary>
        /// Creates mappings for a document given a search map
        /// </summary>
        /// <param name="map">The mappings</param>
        /// <returns>The newly created document mappings</returns>
        public DocumentMapping CreateDocument(ISearchMap map)
        {
            // Create the identity mappings
            var identity = CreateIdentity(map.Identity);

            // Create the fields mappings
            var fields = map.Mappings.Select(x => CreateField(x, map));

            // Create a new document mappings
            var document = new DocumentMapping(map.DocumentType, identity, fields);

            // TODO : Set the fields searchable by default

            // Return the newly created document
            return(document);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Creates mappings for a field given a builder and a search map for default values
        /// </summary>
        /// <param name="builder">The builder</param>
        /// <param name="map">The mappings</param>
        /// <returns>The newly created field mappings</returns>
        public FieldMapping CreateField(PropertyBuilder builder, ISearchMap map)
        {
            // Create the field from the member backing the property builder
            var field = new FieldMapping(builder.Member);

            // Set additionnal values
            field.AnalyzerType = builder.AnalyzerType ?? map.AnalyzerType ?? typeof(StandardAnalyzer);
            field.Boost        = builder.BoostValue ?? 1;
            field.Index        = builder.Indexed.Index ?? map.Index.Index ?? FieldIndex.Tokenized;
            field.IsSortable   = builder.IsSortable ?? map.Sortable.IsSortable ?? false;
            field.Name         = builder.FieldName ?? builder.Member.Name;
            field.Store        = builder.Stored.Store ?? map.Storage.Store ?? FieldStore.Yes;

            // Find the mapping type
            field.MappingType = TypeFactory.GetFor(builder.Member.MemberType);

            // Return the newly created field
            return(field);
        }
Exemplo n.º 3
0
 public RecallSpell(Mobile caster, Item scroll, ISearchMap map)
     : base(caster, scroll, m_Info)
 {
     m_SearchMap = map;
 }
 protected DocumentMapping ToMappingModel(ISearchMap map)
 {
     return(MappingFactory.CreateDocument(map));
 }