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


C# Document.SetBoost方法代码示例

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


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

示例1: CreateIndex2

        private void CreateIndex2()
        {
            IndexWriter iw = null;
            iw = new IndexWriter("D:\\lucene", anay, true);

            DataTable dt = SqlHelper2.QueryTable("select  a_id, b_name,u_nickname,a_title,a_content,b_id from v_article");

            foreach (DataRow dr in dt.Rows)
            {
                Document doc = new Document();
                string title = dr["a_title"].ToString();
                string content = dr["a_content"].ToString();
                string nickname = dr["u_nickname"].ToString();
                string bname = dr["b_name"].ToString();
                string bid = dr["b_id"].ToString();
                string aid = dr["a_id"].ToString();
                if (aid == "5938")
                {
                    doc.SetBoost(100);
                }
                doc.Add(Field.Keyword("title", title));
                doc.Add(Field.Keyword("content", content));
                doc.Add(Field.Keyword("nick", nickname));
                doc.Add(Field.Text("bname", bname));
                doc.Add(Field.Keyword("bid", bid));
                doc.Add(Field.Keyword("aid", aid));

                iw.AddDocument(doc);
            }
            iw.Optimize();
            iw.Close();
            Response.Write("<script>alert('建立索引完成!');</script>");
        }
开发者ID:popotans,项目名称:hjnlib,代码行数:33,代码来源:CreateIndex.aspx.cs

示例2: TestDocBoost_Renamed_Method

		public virtual void  TestDocBoost_Renamed_Method()
		{
			RAMDirectory store = new RAMDirectory();
			IndexWriter writer = new IndexWriter(store, new SimpleAnalyzer(), true);
			
			Fieldable f1 = new Field("field", "word", Field.Store.YES, Field.Index.TOKENIZED);
			Fieldable f2 = new Field("field", "word", Field.Store.YES, Field.Index.TOKENIZED);
			f2.SetBoost(2.0f);
			
			Lucene.Net.Documents.Document d1 = new Lucene.Net.Documents.Document();
			Lucene.Net.Documents.Document d2 = new Lucene.Net.Documents.Document();
			Lucene.Net.Documents.Document d3 = new Lucene.Net.Documents.Document();
			Lucene.Net.Documents.Document d4 = new Lucene.Net.Documents.Document();
			d3.SetBoost(3.0f);
			d4.SetBoost(2.0f);
			
			d1.Add(f1); // boost = 1
			d2.Add(f2); // boost = 2
			d3.Add(f1); // boost = 3
			d4.Add(f2); // boost = 4
			
			writer.AddDocument(d1);
			writer.AddDocument(d2);
			writer.AddDocument(d3);
			writer.AddDocument(d4);
			writer.Optimize();
			writer.Close();
			
			float[] scores = new float[4];
			
			new IndexSearcher(store).Search(new TermQuery(new Term("field", "word")), new AnonymousClassHitCollector(scores, this));
			
			float lastScore = 0.0f;
			
			for (int i = 0; i < 4; i++)
			{
				Assert.IsTrue(scores[i] > lastScore);
				lastScore = scores[i];
			}
		}
开发者ID:vikasraz,项目名称:indexsearchutils,代码行数:40,代码来源:TestDocBoost.cs

示例3: IndexDocuments

		public override void IndexDocuments(AbstractViewGenerator viewGenerator, IEnumerable<object> documents, WorkContext context, IStorageActionsAccessor actions, DateTime minimumTimestamp)
		{
			var count = 0;
			Write(context, (indexWriter, analyzer, stats) =>
			{
				var processedKeys = new HashSet<string>();
				var batchers = context.IndexUpdateTriggers.Select(x => x.CreateBatcher(name))
					.Where(x => x != null)
					.ToList();
				var documentsWrapped = documents.Select((dynamic doc) =>
				{
					if(doc.__document_id == null)
						throw new ArgumentException(string.Format("Cannot index something which doesn't have a document id, but got: '{0}'", doc));

					count++;
					string documentId = doc.__document_id.ToString();
					if (processedKeys.Add(documentId) == false)
						return doc;
					batchers.ApplyAndIgnoreAllErrors(
						exception =>
						{
							logIndexing.WarnException(
								string.Format("Error when executed OnIndexEntryDeleted trigger for index '{0}', key: '{1}'",
												   name, documentId),
								exception);
							context.AddError(name,
											 documentId,
											 exception.Message
								);
						},
						trigger => trigger.OnIndexEntryDeleted(documentId));
					indexWriter.DeleteDocuments(new Term(Constants.DocumentIdFieldName, documentId.ToLowerInvariant()));
					return doc;
				});
				var anonymousObjectToLuceneDocumentConverter = new AnonymousObjectToLuceneDocumentConverter(indexDefinition);
				var luceneDoc = new Document();
				var documentIdField = new Field(Constants.DocumentIdFieldName, "dummy", Field.Store.YES, Field.Index.ANALYZED_NO_NORMS);
				foreach (var doc in RobustEnumerationIndex(documentsWrapped, viewGenerator.MapDefinitions, actions, context, stats))
				{
					count++;

					float boost;
					var indexingResult = GetIndexingResult(doc, anonymousObjectToLuceneDocumentConverter, out boost);

					if (indexingResult.NewDocId != null && indexingResult.ShouldSkip == false)
					{
						count += 1;
						luceneDoc.GetFields().Clear();
						luceneDoc.SetBoost(boost);
						documentIdField.SetValue(indexingResult.NewDocId.ToLowerInvariant());
						luceneDoc.Add(documentIdField);
						foreach (var field in indexingResult.Fields)
						{
							luceneDoc.Add(field);
						}
						batchers.ApplyAndIgnoreAllErrors(
							exception =>
							{
								logIndexing.WarnException(
									string.Format( "Error when executed OnIndexEntryCreated trigger for index '{0}', key: '{1}'",
													   name, indexingResult.NewDocId),
									exception);
								context.AddError(name,
												 indexingResult.NewDocId,
												 exception.Message
									);
							},
							trigger => trigger.OnIndexEntryCreated(indexingResult.NewDocId, luceneDoc));
						LogIndexedDocument(indexingResult.NewDocId, luceneDoc);
						AddDocumentToIndex(indexWriter, luceneDoc, analyzer);
					}

					stats.IndexingSuccesses++;
				}
				batchers.ApplyAndIgnoreAllErrors(
					e =>
					{
						logIndexing.WarnException("Failed to dispose on index update trigger", e);
						context.AddError(name, null, e.Message);
					},
					x => x.Dispose());
				return count;
			});
			logIndexing.Debug("Indexed {0} documents for {1}", count, name);
		}
开发者ID:bstrausser,项目名称:ravendb,代码行数:85,代码来源:SimpleIndex.cs

示例4: IndexSerial

		public static void  IndexSerial(System.Collections.IDictionary docs, Directory dir)
		{
			IndexWriter w = new IndexWriter(dir, new WhitespaceAnalyzer(), IndexWriter.MaxFieldLength.UNLIMITED);
			
			// index all docs in a single thread
			System.Collections.IEnumerator iter = docs.Values.GetEnumerator();
			while (iter.MoveNext())
			{
				Document d = (Document) iter.Current;
				System.Collections.ArrayList fields = new System.Collections.ArrayList();
				fields.AddRange(d.GetFields());
				// put fields in same order each time
                //{{Lucene.Net-2.9.1}} No, don't change the order of the fields
				//SupportClass.CollectionsHelper.Sort(fields, fieldNameComparator);
				
				Document d1 = new Document();
				d1.SetBoost(d.GetBoost());
				for (int i = 0; i < fields.Count; i++)
				{
					d1.Add((Fieldable) fields[i]);
				}
				w.AddDocument(d1);
				// System.out.println("indexing "+d1);
			}
			
			w.Close();
		}
开发者ID:VirtueMe,项目名称:ravendb,代码行数:27,代码来源:TestStressIndexing2.cs

示例5: CreateIndexDocuementForTicket

        private Document CreateIndexDocuementForTicket(Ticket ticket)
        {
            var doc = new Document();
            
            var commentTexts = (from c in ticket.TicketComments
                                select c.Comment);
            StringBuilder sb = new StringBuilder();
            foreach (var c in commentTexts)
            {
                sb.AppendLine(c);
            }
            var commentText = sb.ToString();

            Lucene.Net.Documents.Field idField = new Lucene.Net.Documents.Field
                                                   (
                                                       "ticketid",
                                                       ticket.TicketId.ToString(),
                                                       Lucene.Net.Documents.Field.Store.YES,
                                                       Lucene.Net.Documents.Field.Index.NO,
                                                       Lucene.Net.Documents.Field.TermVector.NO
                                                   );

            Lucene.Net.Documents.Field titleField = new Lucene.Net.Documents.Field
                                                    (
                                                        "title",
                                                        ticket.Title ?? string.Empty,
                                                        Lucene.Net.Documents.Field.Store.YES,
                                                        Lucene.Net.Documents.Field.Index.ANALYZED,
                                                        Lucene.Net.Documents.Field.TermVector.YES
                                                    );
            titleField.SetBoost(1.5F);

            Lucene.Net.Documents.Field detailsField = new Lucene.Net.Documents.Field
                                                    (
                                                        "details",
                                                        ticket.Details ?? string.Empty,
                                                        Lucene.Net.Documents.Field.Store.NO,
                                                        Lucene.Net.Documents.Field.Index.ANALYZED,
                                                        Lucene.Net.Documents.Field.TermVector.YES
                                                    );
            detailsField.SetBoost(1F);



            Lucene.Net.Documents.Field tagsField = new Lucene.Net.Documents.Field
                                                    (
                                                        "tags",
                                                        ticket.TagList ?? string.Empty,
                                                        Lucene.Net.Documents.Field.Store.NO,
                                                        Lucene.Net.Documents.Field.Index.ANALYZED,
                                                        Lucene.Net.Documents.Field.TermVector.NO
                                                    );
            tagsField.SetBoost(2F);

            Lucene.Net.Documents.Field commentsField = new Lucene.Net.Documents.Field
                                                    (
                                                        "comments",
                                                        commentText ?? string.Empty,
                                                        Lucene.Net.Documents.Field.Store.NO,
                                                        Lucene.Net.Documents.Field.Index.ANALYZED,
                                                        Lucene.Net.Documents.Field.TermVector.YES
                                                    );
            commentsField.SetBoost(.8F);


            doc.Add(idField);
            doc.Add(titleField);
            doc.Add(detailsField);
            doc.Add(tagsField);
            doc.Add(commentsField);
            if (ticket.CurrentStatus != "Closed")
            {
                doc.SetBoost(10F);
            }
            return doc;
        }
开发者ID:robkobobko,项目名称:TicketDesk,代码行数:76,代码来源:TicketSearchService.cs

示例6: GetDocument

        public Document GetDocument(object instance, object id, Type entityType)
        {
            Document doc = new Document();

            if (rootClassMapping.Boost != null)
            {
                doc.SetBoost(rootClassMapping.Boost.Value);
            }

            // TODO: Check if that should be an else?
            {
                Field classField = new Field(CLASS_FIELDNAME, TypeHelper.LuceneTypeName(entityType), Field.Store.YES, Field.Index.UN_TOKENIZED);
                doc.Add(classField);
                idMapping.Bridge.Set(idMapping.Name, id, doc, Field.Store.YES, Field.Index.UN_TOKENIZED, idMapping.Boost);
            }

            BuildDocumentFields(instance, doc, rootClassMapping, string.Empty);
            return doc;
        }
开发者ID:spib,项目名称:nhcontrib,代码行数:19,代码来源:DocumentBuilder.cs

示例7: CreateDocument

        /// <summary>
        /// ����������
        /// </summary>
        /// <param name="id">�ĵ�ID��</param>
        /// <param name="author">����</param>
        /// <param name="cat">�������(����ID)</param>
        /// <param name="title">���±���</param>
        /// <param name="body">��������</param>
        /// <param name="tag">��ǩ</param>
        /// <param name="path">�ĵ�·��</param>
        /// <returns></returns>
        public static Lucene.Net.Documents.Document CreateDocument(string id, string author, string cat, string title, string body, string tag, string path)
        {
            Lucene.Net.Documents.Document doc = new Lucene.Net.Documents.Document();

            doc.Add(new Field("id", id, Field.Store.YES, Field.Index.UN_TOKENIZED, Field.TermVector.NO));
            doc.Add(new Field("author", author, Field.Store.NO, Field.Index.UN_TOKENIZED, Field.TermVector.NO));
            doc.Add(new Field("cat", cat, Field.Store.NO, Field.Index.UN_TOKENIZED, Field.TermVector.NO));
            doc.Add(new Field("title", title, Field.Store.NO, Field.Index.TOKENIZED, Field.TermVector.NO));
            doc.Add(new Field("body", body, Field.Store.NO, Field.Index.TOKENIZED, Field.TermVector.WITH_OFFSETS));
            doc.Add(new Field("tag", tag, Field.Store.NO, Field.Index.TOKENIZED, Field.TermVector.NO));
            doc.Add(new Field("path", path, Field.Store.NO, Field.Index.TOKENIZED, Field.TermVector.NO));
            doc.Add(new Field("date", DateField.DateToString(DateTime.Now), Field.Store.YES, Field.Index.NO, Field.TermVector.NO));

            //����Ȩ�أ�Խ���������Ȩ��Խ������������е�λ�ÿ�ǰ�Ļ����Խ��
            float boost = Single.Parse(DateTime.Now.ToString("0.yyyyMMddhh"));
            doc.SetBoost(boost);

            //ȷ�������ĵ�ѹ������·��
            string fpath = Directorys.StoreDirectory + Math.Ceiling(Double.Parse(id) / 10000D).ToString("f0");
            if (!System.IO.Directory.Exists(fpath))
            {
                System.IO.Directory.CreateDirectory(fpath);
            }

            //���ĵ���gzip��ʽ���浽��Ӧλ��
            StoreWriter store = new StoreWriter(fpath + @"\" + id + ".gz");
            store.WriteLine(author);
            store.WriteLine(cat);
            store.WriteLine(tag);
            store.WriteLine(title);
            store.WriteLine(path);
            store.WriteLine(body);
            store.Close();

            return doc;
        }
开发者ID:sqzhuyi,项目名称:cnopenblog,代码行数:47,代码来源:Util.cs

示例8: GetDocument

        public Document GetDocument(object instance, object id)
        {
            Document doc = new Document();
            System.Type instanceClass = instance.GetType();
            if (rootPropertiesMetadata.boost != null)
            {
                doc.SetBoost(rootPropertiesMetadata.boost.Value);
            }

            // TODO: Check if that should be an else?
            {
                Field classField = new Field(CLASS_FIELDNAME, TypeHelper.LuceneTypeName(instanceClass), Field.Store.YES, Field.Index.UN_TOKENIZED);
                doc.Add(classField);
                idBridge.Set(idKeywordName, id, doc, Field.Store.YES, Field.Index.UN_TOKENIZED, idBoost);
            }

            BuildDocumentFields(instance, doc, rootPropertiesMetadata);
            return doc;
        }
开发者ID:mpielikis,项目名称:nhibernate-contrib,代码行数:19,代码来源:DocumentBuilder.cs

示例9: CreateIndex

        /// <summary>
        /// 创建索引
        /// </summary>
        public void CreateIndex()
        {
            var doc = new Document();

            // 构造一个域信息
            /*
             Field.Store.YES:存储字段值(未分词前的字段值)
             Field.Store.NO:不存储,存储与索引没有关系
             Field.Store.COMPRESS:压缩存储,用于长文本或二进制,但性能受损
             Field.Index.ANALYZED:分词建索引
             Field.Index.ANALYZED_NO_NORMS:分词建索引,但是Field的值不像通常那样被保存,而是只取一个byte,这样节约存储空间
             Field.Index.NOT_ANALYZED:不分词且索引
             Field.Index.NOT_ANALYZED_NO_NORMS:不分词建索引,Field的值去一个byte保存
             TermVector表示文档的条目(由一个Document和Field定位)和它们在当前文档中所出现的次数
             Field.TermVector.YES:为每个文档(Document)存储该字段的TermVector
             Field.TermVector.NO:不存储TermVector
             Field.TermVector.WITH_POSITIONS:存储位置
             Field.TermVector.WITH_OFFSETS:存储偏移量
             Field.TermVector.WITH_POSITIONS_OFFSETS:存储位置和偏移量
             */

            var field1 = new Field("title", "笑傲江湖", Field.Store.YES, Field.Index.ANALYZED);

            // Field设置权重
            field1.SetBoost(1.1f);

            // 向文档中添加域
            doc.Add(field1);

            // 设置文档的权重(默认权重是1.0)
            doc.SetBoost(2);

            this.indexWriter.AddDocument(doc);

            // 优化索引结构
            this.indexWriter.Optimize();

            // this.indexWriter.Commit();

            // 关闭写入
            this.indexWriter.Close();
        }
开发者ID:jiangguang5201314,项目名称:DotNetFramework,代码行数:45,代码来源:SearchBase.cs

示例10: Index

 /// <summary>
 /// This method will index the contents present in the dictionary 
 /// </summary>
 /// <param name="keyValueDic">Dictionary object holding the key value pairs </param>
 public void Index(StringDictionary keyValueDic)
 {
     Document doc = new Document();
     foreach (string key in keyValueDic.Keys)
     {
         if (keyValueDic[key] != null)
         {
             if (key == "content")
             {
                 try
                 {
                     if (keyValueDic["type"] == ".rar" || keyValueDic["type"] == ".zip" || keyValueDic["type"] == ".gz" || keyValueDic["type"] == ".bz2" || keyValueDic["type"] == ".tar")
                         pfaw.AddAnalyzer("content", standardAnalyzer);  //for archive files v use standard analyzer
                     else pfaw.AddAnalyzer("content", stopAnalyzer);
                     doc.Add(new Field(key, new StreamReader(keyValueDic[key])));
                 }
                 catch { }
             }
             //else if (key == "path") doc.Add(new Field(key, keyValueDic[key], Field.Store.YES, Field.Index.NO));
             else if (key == "size") doc.Add(new Field(key, keyValueDic[key].PadLeft(12, '0'), Field.Store.YES, Field.Index.NO_NORMS));
             else doc.Add(new Field(key, keyValueDic[key].ToLower(), Field.Store.YES, Field.Index.NO_NORMS));
         }
     }
     try
     {
         if (keyValueDic["attr"].ToLower().Contains("hidden")) doc.SetBoost(.5f);  //setting the ranking or boosting factor of the document
         index.AddDocument(doc);
     }
     catch (Exception ex) {/* Console.WriteLine(keyValueDic["path"] + e.Message + " == " + e.StackTrace + "  " + e.Source); */}
 }
开发者ID:vineelkovvuri,项目名称:ExtendableDesktopSearch,代码行数:34,代码来源:EDSIndexer.cs

示例11: AddDocument

 private void AddDocument(IndexWriter writer, string title, string url, string site, string body, string publish_time,int boost)
 {
     Document document = new Document();
     Field ftitle = new Field("title", title, Field.Store.YES, Field.Index.ANALYZED);
     document.Add(ftitle);//存储,索引
     document.Add(new Field("url", url, Field.Store.YES, Field.Index.NOT_ANALYZED));//存储,不索引
     document.Add(new Field("site", site, Field.Store.YES, Field.Index.NOT_ANALYZED));//存储,不索引
     Field fbody = new Field("body", body, Field.Store.YES, Field.Index.ANALYZED);
     document.Add(fbody);//存储,索引
     document.Add(new Field("publish_time", publish_time, Field.Store.YES, Field.Index.NOT_ANALYZED));//存储,不索引
     document.SetBoost(boost);
     writer.AddDocument(document);
 }
开发者ID:andylaudotnet,项目名称:StockFoo,代码行数:13,代码来源:BoostManage.aspx.cs

示例12: IndexSerial

		public static void  IndexSerial(System.Collections.IDictionary docs, Directory dir)
		{
			IndexWriter w = new IndexWriter(dir, new WhitespaceAnalyzer());
			
			// index all docs in a single thread
			System.Collections.IEnumerator iter = docs.Values.GetEnumerator();
			while (iter.MoveNext())
			{
				Document d = (Document) iter.Current;
				System.Collections.ArrayList fields = new System.Collections.ArrayList();
				fields.AddRange(d.GetFields());
                
                // nonono - can't do this (below)
                //
                // if multiple fields w/ same name, each instance must be
                // added in the same order as orginal doc, as the fields
                // are effectively concatendated
                //
                // term position/offset information must be maintained 
                
                // put fields in same order each time
                //fields.Sort(fieldNameComparator);

				Document d1 = new Document();
				d1.SetBoost(d.GetBoost());
				for (int i = 0; i < fields.Count; i++)
				{
					d1.Add((Fieldable) fields[i]);
				}
				w.AddDocument(d1);
				// System.out.println("indexing "+d1);
			}
			
			w.Close();
		}
开发者ID:vikasraz,项目名称:indexsearchutils,代码行数:35,代码来源:TestStressIndexing2.cs

示例13: OnQueueExpire


//.........这里部分代码省略.........

                            // fetch the page
                            _log.DebugFormat("fetching page content: {0}", contentUri);
                            DreamMessage content = null;
                            yield return Plug.New(contentUri).With("apikey", _apikey).WithTimeout(TimeSpan.FromMinutes(10))
                                .Get(new Result<DreamMessage>())
                                .Set(x => content = x);
                            if(!content.IsSuccessful) {
                                throw BadRequestException(content, "unable to fetch content from '{0}' for '{1}'", contentUri, data.Id);
                            }
                            text = _htmlConverter.Convert(content.ToDocument());
                            d.Add(new Field("size", content.ContentLength.ToString(), Field.Store.YES, Field.Index.UN_TOKENIZED));
                        }

                        // process tags, if they exist
                        if(!data.Meta["tags.uri"].IsEmpty) {
                            Result<DreamMessage> tagsResult;
                            yield return tagsResult = Plug.New(data.Meta["tags.uri"].AsUri).With("apikey", _apikey).GetAsync();
                            if(!tagsResult.Value.IsSuccessful) {
                                throw BadRequestException(tagsResult.Value, "unable to fetch tags from '{0}' for '{1}'", data.Meta["tags.uri"].AsText, data.Id);
                            }
                            XDoc tags = tagsResult.Value.ToDocument();
                            StringBuilder sb = new StringBuilder();
                            foreach(XDoc v in tags["tag/@value"]) {
                                sb.AppendFormat("{0}\n", v.AsText);
                            }
                            d.Add(new Field("tag", sb.ToString(), Field.Store.YES, Field.Index.TOKENIZED));
                        }

                        //Save page properties
                        yield return Coroutine.Invoke(AddPropertiesToDocument, d, pageDoc["properties"], new Result());

                        // set docuemnt boost based on namespace
                        d.SetBoost(GetNamespaceBoost(revision["namespace"].AsText));
                        break;
                    }
                case "files": {
                        var ns = revision["page.parent/namespace"].AsText;
                        if(Array.IndexOf(_indexNamespaceWhitelist, ns) < 0) {
                            _log.DebugFormat("not indexing '{0}', namespace '{1}' is not in whitelist", data.Id, ns);
                            result.Return();
                            yield break;
                        }
                        d.Add(new Field("namespace", ns ?? string.Empty, Field.Store.NO, Field.Index.UN_TOKENIZED));
                        var filename = revision["filename"].AsText;
                        string extension = Path.GetExtension(filename);
                        d.Add(new Field("path", revision["page.parent/path"].AsText ?? string.Empty, Field.Store.YES, Field.Index.TOKENIZED));
                        d.Add(new Field("title.page", revision["page.parent/title"].AsText ?? string.Empty, Field.Store.YES, Field.Index.TOKENIZED));
                        d.Add(new Field("id.page", revision["page.parent/@id"].AsText ?? "0", Field.Store.YES, Field.Index.UN_TOKENIZED));
                        d.Add(new Field("id.file", revision["@id"].AsText ?? "0", Field.Store.YES, Field.Index.UN_TOKENIZED));
                        d.Add(new Field("extension", extension ?? string.Empty, Field.Store.NO, Field.Index.TOKENIZED));
                        d.Add(new Field("filename", filename ?? string.Empty, Field.Store.NO, Field.Index.TOKENIZED));
                        d.Add(new Field("title", filename ?? string.Empty, Field.Store.YES, Field.Index.TOKENIZED));
                        d.Add(new Field("title.sort", filename ?? string.Empty, Field.Store.NO, Field.Index.UN_TOKENIZED));
                        d.Add(new Field("author", revision["user.createdby/username"].AsText ?? string.Empty, Field.Store.YES, Field.Index.TOKENIZED));
                        d.Add(new Field("author.sort", revision["user.createdby/username"].AsText ?? string.Empty, Field.Store.NO, Field.Index.UN_TOKENIZED));
                        d.Add(new Field("description", revision["description"].AsText ?? string.Empty, Field.Store.YES, Field.Index.TOKENIZED));
                        d.Add(new Field("type", GetDocumentType(extension), Field.Store.YES, Field.Index.UN_TOKENIZED));

                        // convert binary types to text
                        Result<Tuplet<string, int>> contentResult;
                        yield return contentResult = Coroutine.Invoke(ConvertToText, extension, new XUri(contentUri), new Result<Tuplet<string, int>>());
                        Tuplet<string, int> content = contentResult.Value;
                        text = content.Item1;
                        var size = content.Item2;
                        if(size == 0) {
开发者ID:heran,项目名称:DekiWiki,代码行数:67,代码来源:LuceneService.cs


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