本文整理汇总了C#中Lucene.GetValues方法的典型用法代码示例。如果您正苦于以下问题:C# Lucene.GetValues方法的具体用法?C# Lucene.GetValues怎么用?C# Lucene.GetValues使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Lucene
的用法示例。
在下文中一共展示了Lucene.GetValues方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SbSearchDoc
/// <summary>
/// Load data directly from lucene document
/// </summary>
/// <param name="doc"></param>
public SbSearchDoc(Lucene.Net.Documents.Document doc)
{
ContentTypes = doc.GetValues("type");
Sources = doc.GetValues("source");
Categories = doc.GetValues("category");
try {
LastModified = DateTimeEx.FromUnixTimestamp(Convert.ToInt32(doc.Get("lastmod")));
} catch { LastModified = DateTime.MinValue; }
Title = doc.Get("title");
Keywords = doc.Get("keywords");
Description = doc.Get("desc");
Author = doc.Get("author");
Location = doc.Get("loc");
// PlainContent = doc.Get("content");
}
示例2: DoAssert
private void DoAssert(Lucene.Net.Documents.Document doc, bool fromIndex)
{
System.String[] keywordFieldValues = doc.GetValues("keyword");
System.String[] textFieldValues = doc.GetValues("text");
System.String[] unindexedFieldValues = doc.GetValues("unindexed");
System.String[] unstoredFieldValues = doc.GetValues("unstored");
Assert.IsTrue(keywordFieldValues.Length == 2);
Assert.IsTrue(textFieldValues.Length == 2);
Assert.IsTrue(unindexedFieldValues.Length == 2);
// this test cannot work for documents retrieved from the index
// since unstored fields will obviously not be returned
if (!fromIndex)
{
Assert.IsTrue(unstoredFieldValues.Length == 2);
}
Assert.IsTrue(keywordFieldValues[0].Equals("test1"));
Assert.IsTrue(keywordFieldValues[1].Equals("test2"));
Assert.IsTrue(textFieldValues[0].Equals("test1"));
Assert.IsTrue(textFieldValues[1].Equals("test2"));
Assert.IsTrue(unindexedFieldValues[0].Equals("test1"));
Assert.IsTrue(unindexedFieldValues[1].Equals("test2"));
// this test cannot work for documents retrieved from the index
// since unstored fields will obviously not be returned
if (!fromIndex)
{
Assert.IsTrue(unstoredFieldValues[0].Equals("test1"));
Assert.IsTrue(unstoredFieldValues[1].Equals("test2"));
}
}