本文整理汇总了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));
}
}
示例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));
}
}
示例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);
}
示例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]);
}
}