Ejemplo n.º 1
0
            public MyIndex_WithoutAnalyzer()
            {
                Map = customers => from customer in customers
                      select new
                {
                    Name = customer.Name
                };

                Indexes.Add(x => x.Name, FieldIndexing.Search);
            }
Ejemplo n.º 2
0
    public CompaniesR_byName()
    {
        Map = companies => from company in companies
              select new
        {
            company.CompanyName
        };

        Indexes.Add(x => x.CompanyName, FieldIndexing.Analyzed);
    }
 public ShoppingCartEventsToShopingCart()
 {
     MapDefinition     = docs => docs.Where(document => document.For == "ShoppingCart");
     GroupByExtraction = source => source.ShoppingCartId;
     ReduceDefinition  = Reduce;
     Indexes.Add("ShoppingCartId", FieldIndexing.NotAnalyzed);
     Indexes.Add("Aggregate", FieldIndexing.No);
     AddField("ShoppingCartId");
     AddField("Aggregate");
 }
Ejemplo n.º 4
0
    public WorkersR_byEmail()
    {
        Map = workers => from worker in workers
              select new
        {
            worker.Email
        };

        Indexes.Add(x => x.Email, FieldIndexing.Analyzed);
    }
Ejemplo n.º 5
0
 private void SetUp(OpCompositeExtract op, SpirvInstructionTreeBuilder treeBuilder)
 {
     ResultType = treeBuilder.ResolveType(op.IdResultType);
     Composite  = treeBuilder.GetNode(op.Composite);
     foreach (var item in op.Indexes)
     {
         Indexes.Add(treeBuilder.Parse(item));
     }
     SetUpDecorations(op, treeBuilder);
 }
Ejemplo n.º 6
0
            public StoresIndex()
            {
                Map = posts => from doc in posts
                      select new { doc.Tags, doc.Content };

                Stores.Add(x => x.Title, FieldStorage.Yes);

                Indexes.Add(x => x.Tags, FieldIndexing.NotAnalyzed);
                Indexes.Add(x => x.Comments, FieldIndexing.No);
            }
Ejemplo n.º 7
0
            public Users_ByHobbies()
            {
                Map = users => from user in users
                      select new
                {
                    user.Hobbies
                };

                Indexes.Add(x => x.Hobbies, FieldIndexing.Analyzed);
            }
Ejemplo n.º 8
0
        public Users_ByName()
        {
            Map = users => from u in users select new { Name = u.Name };

            Indexes.Add(x => x.Name, FieldIndexing.Analyzed);

            IndexSuggestions.Add(x => x.Name, new SuggestionOptions());

            Stores.Add(x => x.Name, FieldStorage.Yes);
        }
Ejemplo n.º 9
0
            public Users_ByName()
            {
                Map = users => from user in users
                      select new
                {
                    user.Name
                };

                Indexes.Add(x => x.Name, FieldIndexing.Analyzed);
            }
Ejemplo n.º 10
0
 protected void Init()
 {
     Indexes.Add(IdIndex);
     Indexes.Add(SubjectIndex);
     Indexes.Add(AttachmentsIndex);
     Indexes.Add(BodyIndex);
     Indexes.Add(HtmlBodyIndex);
     Indexes.Add(FromIndex);
     Indexes.Add(AccountIndex);
 }
Ejemplo n.º 11
0
 public DBColumnList(DBTable table)
     : base(table)
 {
     Indexes.Add(DBColumn.GroupNameInvoker <T> .Instance);
     Indexes.Add(DBColumn.PropertyNameInvoker <T> .Instance);
     Indexes.Add(DBColumn.ReferencePropertyNameInvoker <T> .Instance);
     Indexes.Add(DBColumn.IsViewInvoker <T> .Instance);
     Indexes.Add(DBColumn.IsReferenceInvoker <T> .Instance);
     Indexes.Add(DBColumn.ReferenceTableInvoker <T> .Instance);
 }
Ejemplo n.º 12
0
    public CompaniesR_byEmail()
    {
        Map = companies => from company in companies
              select new
        {
            company.Email
        };

        Indexes.Add(x => x.Email, FieldIndexing.Analyzed);
    }
Ejemplo n.º 13
0
    public WorkersR_byLastName()
    {
        Map = workers => from worker in workers
              select new
        {
            worker.LastName
        };

        Indexes.Add(x => x.LastName, FieldIndexing.Analyzed);
    }
Ejemplo n.º 14
0
        public DocumentTable(DocumentMapping mapping) : base(mapping.TableName)
        {
            // validate to ensure document has an Identity field or property
            mapping.Validate();

            _mapping = mapping;

            var idColumn = new IdColumn(mapping);

            if (mapping.TenancyStyle == TenancyStyle.Conjoined)
            {
                AddPrimaryKeys(new List <TableColumn> {
                    idColumn, mapping.Metadata.TenantId
                });

                Indexes.Add(new IndexDefinition(mapping, TenantIdColumn.Name));
            }
            else
            {
                AddPrimaryKey(idColumn);
            }

            AddColumn <DataColumn>();

            AddIfActive(_mapping.Metadata.LastModified);
            AddIfActive(_mapping.Metadata.Version);
            AddIfActive(_mapping.Metadata.DotNetType);

            AddIfActive(_mapping.Metadata.CorrelationId);
            AddIfActive(_mapping.Metadata.CausationId);
            AddIfActive(_mapping.Metadata.LastModifiedBy);
            AddIfActive(_mapping.Metadata.Headers);

            foreach (var field in mapping.DuplicatedFields)
            {
                AddColumn(new DuplicatedFieldColumn(field));
            }

            if (mapping.IsHierarchy())
            {
                Indexes.Add(new IndexDefinition(_mapping, SchemaConstants.DocumentTypeColumn));
                AddColumn(_mapping.Metadata.DocumentType);
            }

            if (mapping.DeleteStyle == DeleteStyle.SoftDelete)
            {
                AddColumn(_mapping.Metadata.IsSoftDeleted);
                Indexes.Add(new IndexDefinition(mapping, SchemaConstants.DeletedColumn));

                AddColumn(_mapping.Metadata.SoftDeletedAt);
            }

            Indexes.AddRange(mapping.Indexes);
            ForeignKeys.AddRange(mapping.ForeignKeys);
        }
Ejemplo n.º 15
0
        internal Index <T> AddIndexer <T, TProperty>(Expression <Func <T, TProperty> > indexer, IEqualityComparer <TProperty> comparer = default)
        {
            var property      = ExpressionReflector.GetProperty(indexer);
            var usedComparer  = comparer ?? EqualityComparer <TProperty> .Default;
            var indexedValues = ((IEnumerable <T>)Values).ToLookup(indexer.Compile(), usedComparer);
            var result        = new Index <T>(property, indexedValues, usedComparer);

            Indexes.Add(result);

            return(result);
        }
Ejemplo n.º 16
0
            public MyIndex(string analyzerName)
            {
                Map = customers => from customer in customers
                      select new
                {
                    Name = customer.Name
                };

                Indexes.Add(x => x.Name, FieldIndexing.Search);
                Analyzers.Add(x => x.Name, analyzerName);
            }
Ejemplo n.º 17
0
            public BlogPosts_ByContent()
            {
                Map = posts => from post in posts
                      select new
                {
                    Title   = post.Title,
                    Content = post.Content
                };

                Indexes.Add(x => x.Content, FieldIndexing.Search);
            }
 public ReceivedSmsDataByAcknowledgement()
 {
     Map = smsReceivedDatas => from receivedData in smsReceivedDatas
           select new
     {
         CreationDate = receivedData.SmsConfirmationData.SentAtUtc,
         receivedData.Acknowledge
     };
     Indexes.Add(c => c.SmsConfirmationData.SentAtUtc, FieldIndexing.Default);
     Indexes.Add(c => c.Acknowledge, FieldIndexing.Default);
 }
Ejemplo n.º 19
0
            public Employees_ByFirstAndLastName()
            {
                Map = employees => from employee in employees
                      select new
                {
                    LastName  = employee.LastName,
                    FirstName = employee.FirstName
                };

                Indexes.Add(x => x.FirstName, FieldIndexing.Exact);
            }
Ejemplo n.º 20
0
 public HotelRoom_Search()
 {
     Map = rooms => from room in rooms
           select new
     {
         //bla bla
         room.DndUntilUtc                    // add this line
         //bla bla
     };
     Indexes.Add(x => x.DndUntilUtc, FieldIndexing.Analyzed);
 }
Ejemplo n.º 21
0
            public Products_ByName()
            {
                Map = products => from product in products
                      select new
                {
                    product.Name
                };

                Indexes.Add(x => x.Name, FieldIndexing.Search);     // (optional) splitting name into multiple tokens
                Suggestion(x => x.Name);                            // configuring suggestions
            }
Ejemplo n.º 22
0
            public Products_ByName_Search()
            {
                Map = products => from product in products
                      select new
                {
                    Name           = product.Name,
                    NameForSorting = product.Name
                };

                Indexes.Add(x => x.Name, FieldIndexing.Search);
            }
Ejemplo n.º 23
0
            public Products_ByName()
            {
                Map = products => from product in products
                      select new
                {
                    product.Name
                };

                Indexes.Add(x => x.Name, FieldIndexing.Analyzed);
                Suggestion(x => x.Name);
            }
Ejemplo n.º 24
0
 public CoordinatorTrackingDataByDate()
 {
     Map = coordinators => from coordinator in coordinators
           select new
     {
         CreationDate = coordinator.CreationDateUtc,
         Status       = coordinator.CurrentStatus
     };
     Indexes.Add(c => c.CreationDateUtc, FieldIndexing.Default);
     Indexes.Add(c => c.CurrentStatus, FieldIndexing.Default);
 }
Ejemplo n.º 25
0
        /// <summary>
        ///     Adds a computed index
        /// </summary>
        /// <param name="expressions"></param>
        /// <param name="configure"></param>
        public void Index(IReadOnlyCollection <Expression <Func <T, object> > > expressions,
                          Action <ComputedIndex> configure = null)
        {
            var members = expressions
                          .Select(FindMembers.Determine).ToArray();

            var index = new ComputedIndex(this, members);

            configure?.Invoke(index);
            Indexes.Add(index);
        }
Ejemplo n.º 26
0
        public DocumentTable(DocumentMapping mapping) : base(mapping.TableName)
        {
            // validate to ensure document has an Identity field or property
            mapping.CompileAndValidate();

            _mapping = mapping;

            var idColumn = new IdColumn(mapping);

            AddColumn(idColumn).AsPrimaryKey();

            if (mapping.TenancyStyle == TenancyStyle.Conjoined)
            {
                AddColumn(mapping.Metadata.TenantId).AsPrimaryKey();

                Indexes.Add(new DocumentIndex(mapping, TenantIdColumn.Name));
            }

            AddColumn <DataColumn>();

            AddIfActive(_mapping.Metadata.LastModified);
            AddIfActive(_mapping.Metadata.Version);
            AddIfActive(_mapping.Metadata.DotNetType);

            AddIfActive(_mapping.Metadata.CorrelationId);
            AddIfActive(_mapping.Metadata.CausationId);
            AddIfActive(_mapping.Metadata.LastModifiedBy);
            AddIfActive(_mapping.Metadata.Headers);

            foreach (var field in mapping.DuplicatedFields.Where(x => !x.OnlyForSearching))
            {
                AddColumn(new DuplicatedFieldColumn(field));
            }

            if (mapping.IsHierarchy())
            {
                Indexes.Add(new DocumentIndex(_mapping, SchemaConstants.DocumentTypeColumn));
                AddColumn(_mapping.Metadata.DocumentType);
            }

            if (mapping.DeleteStyle == DeleteStyle.SoftDelete)
            {
                AddColumn(_mapping.Metadata.IsSoftDeleted);
                Indexes.Add(new DocumentIndex(mapping, SchemaConstants.DeletedColumn));

                AddColumn(_mapping.Metadata.SoftDeletedAt);
            }

            Indexes.AddRange(mapping.Indexes);
            ForeignKeys.AddRange(mapping.ForeignKeys);

            // Compatibility with Marten rules
            PrimaryKeyName = $"{Identifier.Name}_pkey";
        }
Ejemplo n.º 27
0
        public Users_ByName()
        {
            Map = users => from u in users select new { Name = u.Name, LastName = u.LastName.Boost(10) };

            Indexes.Add(x => x.Name, FieldIndexing.Analyzed);

            IndexSuggestions.Add(x => x.Name, new SuggestionOptions());

            Analyzers.Add(x => x.Name, typeof(SimpleAnalyzer).FullName);

            Stores.Add(x => x.Name, FieldStorage.Yes);
        }
Ejemplo n.º 28
0
            public BlogPosts_ByTitle()
            {
                Map = posts => from post in posts
                      select new
                {
                    Title   = post.Title,
                    Content = post.Content
                };

                Indexes.Add(x => x.Content, FieldIndexing.No);
                Stores.Add(x => x.Content, FieldStorage.Yes);
            }
Ejemplo n.º 29
0
        public Users_ByName()
        {
            Map = users => from u in users select new { Name = u.Name, LastName = u.LastName.Boost(10) };

            Indexes.Add(x => x.Name, FieldIndexing.Search);

            IndexSuggestions.Add(x => x.Name);

            Analyzers.Add(x => x.Name, typeof(Lucene.Net.Analysis.SimpleAnalyzer).FullName);

            Stores.Add(x => x.Name, FieldStorage.Yes);
        }
Ejemplo n.º 30
0
            public FooIndex()
            {
                Map = docs => from doc in docs
                      select new IndexEntry
                {
                    Name        = doc.Name,
                    Resolutions = doc.Resolutions
                };

                Indexes.Add(x => x.Name, FieldIndexing.Search);
                Stores.Add(x => x.Resolutions, FieldStorage.Yes);
            }