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


C# Lucene.Get方法代码示例

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


在下文中一共展示了Lucene.Get方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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");
        }
开发者ID:bogdan-litescu,项目名称:SearchBoost.NET,代码行数:21,代码来源:SbSearchDoc.cs

示例2: SetProperty

 public void SetProperty(Lucene.Net.Documents.Document doc)
 {
     if (doc != null)
     {
         this.SchoolId = XConvert.ToInt32(doc.Get("SchoolId"), -1);
         this.Type = (SchoolType)XConvert.ToByte(doc.Get("Type"));
         this.Name = doc.Get("Name");
         this.CnName = doc.Get("CnName");
         this.Pinyin = doc.Get("Pinyin");
         this.RegionId = XConvert.ToInt32(doc.Get("RegionId"), -1);
         this.StateId = XConvert.ToInt32(doc.Get("StateId"), -1);
         this.CityId = XConvert.ToInt32(doc.Get("CityId"), -1);
     }
 }
开发者ID:cityjoy,项目名称:TextIndexMaker,代码行数:14,代码来源:SchoolSample.cs

示例3: Hit

        /// <summary>
        /// ���н�����캯��
        /// </summary>
        /// <param name="doc">������</param>
        /// <param name="offset">�ؼ����������е�λ��</param>
        internal Hit(Lucene.Net.Documents.Document doc, int offset)
        {
            base.id = doc.Get("id");
            base.lastIndex = Lucene.Net.Documents.DateField.StringToDate(doc.Get("date"));

            //�����ⲿ��ŵ��ĵ�ʵ��
            StoreReader story = new StoreReader(Directorys.StoreDirectory + Math.Ceiling(Double.Parse(base.id) / 10000D).ToString("f0") + @"\" + base.id + ".gz");
            //��ȡ�ѱ��������ͷ
            base.author = story.ReadLine();
            base.cat = story.ReadLine();
            base.tag = story.ReadLine();
            base.title = story.ReadLine();
            base.path = story.ReadLine();

            int readed = 0;

            int len = 126;//��ʾ���ݳ���

            char[] block = new char[offset + len];

            //��ȡ�������ؼ��ֺ�len���ַ�
            readed = story.ReadBlock(block, 0, block.Length);

            story.Close();

            int index = offset;

            //����ؼ��ֲ��ڽ�β����ժҪ��ʼλ�ö�λ�ڹؼ���ǰһ��������֮�󣬷���ժҪȡĩβ��len���ַ�
            if (readed == block.Length)
            {
                UnicodeCategory category;
                for (; index > 0; index--)
                {
                    category = Char.GetUnicodeCategory(Char.ToLower(block[index]));
                    if (category == UnicodeCategory.OtherPunctuation)
                    {
                        index += 1;
                        break;
                    }
                }
            }
            else
            {
                index = Math.Max(0, readed - len);
            }

            //���ժҪ���ڽ�β�����ں�����ӡ�...��
            base.body = (new String(block, index, Math.Min(len - 1, readed))) + ((readed >= index + len) ? "..." : "");
        }
开发者ID:sqzhuyi,项目名称:cnopenblog,代码行数:54,代码来源:Document.cs


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