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


C# Lucene.Add方法代码示例

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


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

示例1: AddAllFields

        protected override void AddAllFields(Lucene.Net.Documents.Document document, Data.Items.Item item, bool versionSpecific)
        {
            base.AddAllFields(document, item, versionSpecific);

            if (item != null && document != null)
            {
            #if SC70
                var fieldAnalysis = Field.Index.ANALYZED;
            #else
                var fieldAnalysis = Field.Index.TOKENIZED;
            #endif

                // Sitecore 6.2 does not include template
                document.Add(new Field(Constants.Index.Fields.Template, TransformValue(item.TemplateID), Field.Store.NO, fieldAnalysis));

                // Add multilist fields
                foreach (var fieldName in m_multilistFields)
                {
                    if(item.Fields[fieldName] != null)
                        document.Add(new Field(fieldName, TransformMultilistValue(item.Fields[fieldName]), Field.Store.YES, fieldAnalysis));
                }

                // Add additional fields
                foreach (var fieldName in m_dataFieldNames)
                {
                    if (item.Fields[fieldName] != null)
                    {
                        document.Add(new Field(fieldName, TransformCSV(item.Fields[fieldName].Value), Field.Store.YES, fieldAnalysis));
                    }
                }

                // Add modified language code to deal with dash in region specific languages
                document.Add(new Field(Constants.Index.Fields.Language, TransformLanguageCode(item.Language.Name), Field.Store.NO, fieldAnalysis));
            }
        }
开发者ID:jakebz33,项目名称:WeBlog,代码行数:35,代码来源:DatabaseCrawler.cs

示例2: AddAllFields

        protected override void AddAllFields(Lucene.Net.Documents.Document document, Data.Items.Item item, bool versionSpecific)
        {
            base.AddAllFields(document, item, versionSpecific);

            if (item != null && document != null)
            {
                // Sitecore 6.2 does not include template
                document.Add(new Field(Constants.Index.Fields.Template, TransformValue(item.TemplateID), Field.Store.NO, Field.Index.TOKENIZED));

                // Add publish (or created) date field to allow for publishing restrictions and correct ordering
                var date = item.Publishing.PublishDate;
                if (item.Statistics.Created > date)
                    date = item.Statistics.Created;

                document.Add(new Field(Constants.Index.Fields.Publish, Sitecore.DateUtil.ToIsoDate(date), Field.Store.NO, Field.Index.TOKENIZED));

                // Add multilist fields
                foreach (var fieldName in m_multilistFields)
                {
                    if(item.Fields[fieldName] != null)
                        document.Add(new Field(fieldName, TransformMultilistValue(item.Fields[fieldName]), Field.Store.YES, Field.Index.TOKENIZED));
                }

                // Add additional fields
                foreach (var fieldName in m_dataFieldNames)
                {
                    if (item.Fields[fieldName] != null)
                    {
                        document.Add(new Field(fieldName, TransformCSV(item.Fields[fieldName].Value), Field.Store.YES, Field.Index.TOKENIZED));
                    }
                }

                // Add modified language code to deal with dash in region specific languages
                document.Add(new Field(Constants.Index.Fields.Language, TransformLanguageCode(item.Language.Name), Field.Store.NO, Field.Index.TOKENIZED));
            }
        }
开发者ID:kaytee821,项目名称:WeBlog,代码行数:36,代码来源:DatabaseCrawler.cs

示例3: SetupDoc

		private void  SetupDoc(Lucene.Net.Documents.Document doc, System.String text)
		{
			doc.Add(new Field("field", text, Field.Store.YES, Field.Index.TOKENIZED, Field.TermVector.YES));
			doc.Add(new Field("field2", text, Field.Store.YES, Field.Index.TOKENIZED, Field.TermVector.WITH_POSITIONS_OFFSETS));
			//System.out.println("Document: " + doc);
		}
开发者ID:vikasraz,项目名称:indexsearchutils,代码行数:6,代码来源:TestTermVectors.cs

示例4: SetupDoc

		/// <summary> Adds the fields above to a document </summary>
		/// <param name="doc">The document to write
		/// </param>
		public static void  SetupDoc(Lucene.Net.Documents.Document doc)
		{
			for (int i = 0; i < fields.Length; i++)
			{
				doc.Add(fields[i]);
			}
		}
开发者ID:vikasraz,项目名称:indexsearchutils,代码行数:10,代码来源:DocHelper.cs


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