当前位置: 首页>>代码示例>>C#>>正文


C# IIndex.Add方法代码示例

本文整理汇总了C#中IIndex.Add方法的典型用法代码示例。如果您正苦于以下问题:C# IIndex.Add方法的具体用法?C# IIndex.Add怎么用?C# IIndex.Add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IIndex的用法示例。


在下文中一共展示了IIndex.Add方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: InitGroups

        public void InitGroups(QueryProcessor processor, IIndex<long> emptyIndexContainer)
        {
            Debug.Assert(emptyIndexContainer.Count == 0);

            ITable child = BaseTable;
            // No groups, so make the entire child table the group,
            if (aggregateComposite == null || child.RowCount <= 1) {
                emptyIndexContainer.Add(0);
                emptyIndexContainer.Add(child.RowCount);
            }
                // Populate the index by the aggregate composite,
            else {
                // Create a resolver for the composite function
                IndexResolver resolver = processor.CreateResolver(child, aggregateComposite);

                // The groups state
                long groupPos = 0;
                long groupSize = 0;
                SqlObject[] lastComposite = null;
                // Scan over the child
                IRowCursor cursor = child.GetRowCursor();
                while (cursor.MoveNext()) {
                    RowId rowid = cursor.Current;
                    // Get the group term
                    SqlObject[] groupValue = resolver.GetValue(rowid);
                    if (lastComposite == null) {
                        lastComposite = groupValue;
                    } else {
                        int c = SqlObject.Compare(groupValue, lastComposite);
                        // If group_val > the last composite, we are on a new group
                        if (c > 0) {
                            // New group,
                            emptyIndexContainer.Add(groupPos);
                            emptyIndexContainer.Add(groupSize);
                            lastComposite = groupValue;
                            groupPos = groupPos + groupSize;
                            groupSize = 0;
                        } else if (c < 0) {
                            // This will happen if the child table is not sorted by the
                            // composite expression.
                            throw new ApplicationException("Aggregate child is not sorted correctly.");
                        }
                    }
                    ++groupSize;
                }
                // Final group
                // (the below check probably not necessary since we already check for the
                //  empty child so group size will always be >1 at this point).
                if (groupSize > 0) {
                    emptyIndexContainer.Add(groupPos);
                    emptyIndexContainer.Add(groupSize);
                }
            }
            // Set the group index
            childGroupsIndex = emptyIndexContainer;
            lookupCursor = BaseTable.GetRowCursor();
        }
开发者ID:ikvm,项目名称:deveelsql,代码行数:57,代码来源:AggregateTable.cs

示例2: Import

 public void Import(IIndex index, int count)
 {
     var reader = new DataDumpReader<Post>();
     var xml = Path.Combine(path, "posts.xml");
     index.Add(reader.Read(xml)
         .Where(p => p.PostTypeId == PostTypeId.Question)
         .Take(count));
 }
开发者ID:billings-dot-net-users-group,项目名称:search-demo,代码行数:8,代码来源:StackExchangeImporter.cs

示例3: SetUp

		public void SetUp()
		{
			FullTextSearchIndex index = new FullTextSearchIndex();
			index.Fields.Add("Title");

			FullTextSearchIndex multipleFieldIndex = new FullTextSearchIndex();
			multipleFieldIndex.Fields.Add("Title");
			multipleFieldIndex.Fields.Add("Ingredients");

			_index = index;
			_multipleFieldIndex = multipleFieldIndex;
			
			_record1 = new HashtableRecord();
			_record1["Title"] = "Bolo de Chocolate";
			_record1["Calories"] = 300;
			_record1["Ingredients"] = "3 colheres de açucar\n1 lata de nescau\nfermento";
			_index.Add(_record1);
			_multipleFieldIndex.Add(_record1);
			DumpPostings(index.Postings);

			_record2 = new HashtableRecord();
			_record2["Title"] = "Bolo de Açafrão";
			_record2["Calories"] = 100;
			_record2["Ingredients"] = "10 folhas de açafrão\n1 colher de fermento em pó";
			_index.Add(_record2);
			_multipleFieldIndex.Add(_record2);
			DumpPostings(index.Postings);

			_record3 = new HashtableRecord();
			_record3["Title"] = "Torta de Chocolate";
			_record3["Calories"] = 400;
			_record3["Ingredients"] = "1 lata de nescau\nchocolate granulado\naçucar";
			_index.Add(_record3);
			_multipleFieldIndex.Add(_record3);
			DumpPostings(index.Postings);
		}
开发者ID:giggio,项目名称:Bamboo.Prevalence,代码行数:36,代码来源:FullTextSearchTests.cs


注:本文中的IIndex.Add方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。