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


C# IndexWriter.SetMaxFieldLength方法代码示例

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


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

示例1: LuceneMetadataRepository

 public LuceneMetadataRepository()
 {
     _analyzer = new StandardAnalyzer();
     _directory = FSDirectory.GetDirectory("./index", true);
     _indexWriter = new IndexWriter(_directory, _analyzer, true);
     _indexWriter.SetMaxFieldLength(25000);
     _indexSearcher = new IndexSearcher(_directory);
 }
开发者ID:KevM,项目名称:MassTransit,代码行数:8,代码来源:LuceneMetadataRepository.cs

示例2: Index

        public void Index()
        {
            Directory directory = FSDirectory.GetDirectory("./index", true);
            var iwriter = new IndexWriter(directory, _analyzer, true);
            iwriter.SetMaxFieldLength(25000);

            var x = Repository.List();
            foreach (var package in x)
            {
                var doc = new Document();
                doc.Add(new Field("name", package.Name, Field.Store.YES, Field.Index.TOKENIZED));
                doc.Add(new Field("description", package.Description, Field.Store.YES, Field.Index.TOKENIZED));
                iwriter.AddDocument(doc);
            }

            iwriter.Close();
        }
开发者ID:drusellers,项目名称:biblioteca,代码行数:17,代码来源:LuceneSearch.cs

示例3: TestHighFreqTerm

		public virtual void  TestHighFreqTerm()
		{
			RAMDirectory dir = new RAMDirectory();
			IndexWriter writer = new IndexWriter(dir, new WhitespaceAnalyzer(), true);
			writer.SetRAMBufferSizeMB(0.01);
			writer.SetMaxFieldLength(100000000);
			// Massive doc that has 128 K a's
			System.Text.StringBuilder b = new System.Text.StringBuilder(1024 * 1024);
			for (int i = 0; i < 4096; i++)
			{
				b.Append(" a a a a a a a a");
				b.Append(" a a a a a a a a");
				b.Append(" a a a a a a a a");
				b.Append(" a a a a a a a a");
			}
			Document doc = new Document();
			doc.Add(new Field("field", b.ToString(), Field.Store.YES, Field.Index.TOKENIZED, Field.TermVector.WITH_POSITIONS_OFFSETS));
			writer.AddDocument(doc);
			writer.Close();
			
			IndexReader reader = IndexReader.Open(dir);
			Assert.AreEqual(1, reader.MaxDoc());
			Assert.AreEqual(1, reader.NumDocs());
			Term t = new Term("field", "a");
			Assert.AreEqual(1, reader.DocFreq(t));
			TermDocs td = reader.TermDocs(t);
			td.Next();
			Assert.AreEqual(128 * 1024, td.Freq());
			reader.Close();
			dir.Close();
		}
开发者ID:vikasraz,项目名称:indexsearchutils,代码行数:31,代码来源:TestIndexWriter.cs

示例4: Index

 public static bool Index(Analyzer analyzer, FileIndexSet fileIndex,IndexerSet indexer, bool create)
 {
     try
     {
         IndexWriter writer = new IndexWriter(fileIndex.Path, analyzer, create);
         writer.SetMaxFieldLength(indexer.MaxFieldLength);
         writer.SetRAMBufferSizeMB(indexer.RamBufferSize);
         writer.SetMergeFactor(indexer.MergeFactor);
         writer.SetMaxBufferedDocs(indexer.MaxBufferedDocs);
         foreach (string dir in fileIndex.BaseDirs)
         {
             IndexDir(writer, dir);
         }
         return true;
     }
     catch (Exception )
     {
         return false;
     }
 }
开发者ID:vikasraz,项目名称:indexsearchutils,代码行数:20,代码来源:FileIndexer.cs

示例5: CreateIndexWriter

		/// <summary> Close the IndexReader and open an IndexWriter.</summary>
		/// <throws>  IOException </throws>
		protected internal virtual void  CreateIndexWriter()
		{
			if (indexWriter == null)
			{
				if (indexReader != null)
				{
					indexReader.Close();
					indexReader = null;
				}
				indexWriter = new IndexWriter(directory, analyzer, false);
				indexWriter.SetInfoStream(infoStream);
				indexWriter.SetUseCompoundFile(useCompoundFile);
				indexWriter.SetMaxBufferedDocs(maxBufferedDocs);
				indexWriter.SetMaxFieldLength(maxFieldLength);
				indexWriter.SetMergeFactor(mergeFactor);
			}
		}
开发者ID:zweib730,项目名称:beagrep,代码行数:19,代码来源:IndexModifier.cs

示例6: CreateIndexWriter

		/// <summary> Close the IndexReader and open an IndexWriter.</summary>
		/// <throws>  CorruptIndexException if the index is corrupt </throws>
		/// <throws>  LockObtainFailedException if another writer </throws>
		/// <summary>  has this index open (<code>write.lock</code> could not
		/// be obtained)
		/// </summary>
		/// <throws>  IOException if there is a low-level IO error </throws>
		protected internal virtual void  CreateIndexWriter()
		{
			if (indexWriter == null)
			{
				if (indexReader != null)
				{
					indexReader.Close();
					indexReader = null;
				}
				indexWriter = new IndexWriter(directory, analyzer, false);
				// IndexModifier cannot use ConcurrentMergeScheduler
				// because it synchronizes on the directory which can
				// cause deadlock
				indexWriter.SetMergeScheduler(new SerialMergeScheduler());
				indexWriter.SetInfoStream(infoStream);
				indexWriter.SetUseCompoundFile(useCompoundFile);
				if (maxBufferedDocs != IndexWriter.DISABLE_AUTO_FLUSH)
					indexWriter.SetMaxBufferedDocs(maxBufferedDocs);
				indexWriter.SetMaxFieldLength(maxFieldLength);
				indexWriter.SetMergeFactor(mergeFactor);
			}
		}
开发者ID:vikasraz,项目名称:indexsearchutils,代码行数:29,代码来源:IndexModifier.cs

示例7: IndexFile

 public static bool IndexFile(bool create, IndexCompletedEventHandler OnIndexCompleted, IndexProgressChangedEventHandler OnProgressChanged)
 {
     try
     {
         if (create)
         {
             SupportClass.FileUtil.DeleteFolder(fileSet.Path);
         }
         IndexWriter writer = new IndexWriter(fileSet.Path, analyzer, create);
         writer.SetMaxFieldLength(indexerSet.MaxFieldLength);
         writer.SetRAMBufferSizeMB(indexerSet.RamBufferSize);
         writer.SetMergeFactor(indexerSet.MergeFactor);
         writer.SetMaxBufferedDocs(indexerSet.MaxBufferedDocs);
         int i=0;
         foreach (string dir in fileSet.BaseDirs)
         {
             i++;
             FileIndexer.IndexDir(writer, dir,OnProgressChanged);
             OnProgressChanged("IndexUtil", new IndexProgressChangedEventArgs(fileSet.BaseDirs.Count, i));
         }
         writer.Optimize();
         writer.Close();
         OnIndexCompleted("IndexUtil", new IndexCompletedEventArgs("File"));
         return true;
     }
     catch (Exception e)
     {
         throw e;
     }
 }
开发者ID:vikasraz,项目名称:indexsearchutils,代码行数:30,代码来源:IndexUtil.cs


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