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


C# Document.GetValues方法代码示例

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


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

示例1: BasicAuditEntry

 public BasicAuditEntry(Document doc, int luceneId)
 {
     User = doc.Get("user");
     Role = doc.GetValues("role").ToList();
     Id = new ID(doc.Get("id"));
     Path = doc.Get("path");
     DateTime tmp;
     DateTime.TryParse(doc.Get("timestamp"), out tmp);
     TimeStamp = tmp;
     EventId = doc.Get("event");
     Note = doc.Get("note");
     Label = doc.Get("label");
     Color = doc.Get("color");
     Database = doc.Get("database");
     Uid = luceneId.ToString();
 }
开发者ID:JeffDarchuk,项目名称:SitecoreSidekick,代码行数:16,代码来源:BasicAuditEntry.cs

示例2: PopulateDocument

        public static void PopulateDocument(Document doc, IEnumerable<IFacetHandler> handlers)
        {
            StringBuilder tokenBuffer = new StringBuilder();

            foreach (var handler in handlers)
            {
                string name = handler.Name;
                string[] values = doc.GetValues(name);
                if (values != null)
                {
                    doc.RemoveFields(name);
                    foreach (string value in values)
                    {
                        doc.Add(new Field(name, value, Field.Store.NO, Field.Index.NOT_ANALYZED));
                        tokenBuffer.Append(' ').Append(value);
                    }
                }
            }
        }
开发者ID:yao-yi,项目名称:BoboBrowse.Net,代码行数:19,代码来源:DataDigester.cs

示例3: PopulateDocument

        public static void PopulateDocument(Document doc, FieldConfiguration fConf)
        {
            var fields = fConf.GetFieldNames();

            var tokenBuffer = new StringBuilder();

            for (int i = 0; i < fields.Length; ++i)
            {
                var values = doc.GetValues(fields[i]);
                if (values != null)
                {
                    doc.RemoveFields(fields[i]);
                    for (int k = 0; k < values.Length; ++k)
                    {
                        doc.Add(new Field(fields[i], values[i], Field.Store.NO, Field.Index.NOT_ANALYZED));
                        tokenBuffer.Append(" ").Append(values[i]);
                    }
                }
            }
        }
开发者ID:NightOwl888,项目名称:Bobo-Browse.Net,代码行数:20,代码来源:DataDigester.cs

示例4: DoAssert

		private void  DoAssert(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"));
			}
		}
开发者ID:VirtueMe,项目名称:ravendb,代码行数:31,代码来源:TestDocument.cs

示例5: GetItem

        /// <summary>
        /// Gets an item from mthe document
        /// </summary>
        /// <param name="document">The lucene document to use</param>
        /// <returns></returns>
        protected virtual Item GetItem(Document document)
        {
            string itemShortId = document.GetValues(SitecoreFields.Id).FirstOrDefault();
            if (String.IsNullOrEmpty(itemShortId))
            {
                return null;
            }
            ID itemId = new ID(itemShortId);
            string language = document.GetValues(SitecoreFields.Language).FirstOrDefault();
            if (String.IsNullOrEmpty(language))
            {
                throw new Exception("The language could not be retrieved from the lucene return");
            }
            Language itemLanguage = Language.Parse(language);

            Item item = DatabaseHelper.GetItem(itemId, itemLanguage);
            return item.Versions.Count > 0 ? item : null;
        }
开发者ID:modulexcite,项目名称:Lucinq,代码行数:23,代码来源:SitecoreSearchResult.cs

示例6: GetSecondarySortString

 private string GetSecondarySortString(Document document)
 {
     return String.Format("{0}_{1}", document.GetValues(BBCFields.SecondarySort).FirstOrDefault(), document.GetValues(BBCFields.Sortable).FirstOrDefault());
 }
开发者ID:modulexcite,项目名称:Lucinq,代码行数:4,代码来源:BasicTests..cs

示例7: MapOffer

 private Offer MapOffer(Document doc)
 {
     int attractivenes;
     var strAttractivenes = doc.Get("Attractivenes");
     int.TryParse(strAttractivenes, out attractivenes);
     return new Offer
     {
         Id = doc.Get("Id"),
         Title = doc.Get("Title"),
         Url = doc.Get("Url"),
         Price = doc.Get("Price"),
         Description = TextHelper.CleanText(doc.Get("Description")),
         Pictures = doc.GetValues("Pictures").ToList(),
         Date = DateTools.StringToDate(doc.Get("Date")),
         Teaser = doc.Get("Teaser")=="1",
         PrivateOffer = doc.Get("PrivateOffer") == "1",
         Attractivenes = attractivenes,
         HaveSeen = doc.Get("HaveSeen") == "1",
         Hide = doc.Get("Hide") == "1",
         Notes = doc.Get("Notes")
     };
 }
开发者ID:rezu4,项目名称:ogloszenia,代码行数:22,代码来源:OfferStorage.cs

示例8: CreateSearchResult

        protected SearchResult CreateSearchResult(Document doc, float score)
        {
            string id = doc.Get("id");
            if (string.IsNullOrEmpty(id))
            {
                id = doc.Get(LuceneIndexer.IndexNodeIdFieldName);
            }
            var sr = new SearchResult()
            {
                Id = int.Parse(id),
                Score = score
            };

            //we can use lucene to find out the fields which have been stored for this particular document
            //I'm not sure if it'll return fields that have null values though
            var fields = doc.GetFields();

            //ignore our internal fields though

            foreach (var field in fields.Cast<Field>())
            {
                var fieldName = field.Name();
                var values = doc.GetValues(fieldName);

                if (values.Length > 1)
                {
                    sr.MultiValueFields[fieldName] = values.ToList();
                    //ensure the first value is added to the normal fields
                    sr.Fields[fieldName] = values[0];
                }
                else if (values.Length > 0)
                {
                    sr.Fields[fieldName] = values[0];
                }
            }

            return sr;
        }
开发者ID:modulexcite,项目名称:Examine,代码行数:38,代码来源:SearchResults.cs


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