• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# Lucene类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



Lucene类属于命名空间,在下文中一共展示了Lucene类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: LuceneSearcher

 public LuceneSearcher(Lucene.Net.Store.Directory luceneDirectory, Analyzer analyzer)
     : base(analyzer)
 {
     _disposer = new DisposableSearcher(this);
     LuceneIndexFolder = null;
     _luceneDirectory = luceneDirectory;
 }
开发者ID:bowserm,项目名称:Examine,代码行数:7,代码来源:LuceneSearcher.cs


示例2: Filter

        public List<FacetReturn> Filter(Lucene.Net.Search.Query query, List<Util.SearchStringModel> searchQuery, string locationFilter, System.Collections.BitArray baseQuery)
        {
            if (InAvailableLocations(locationFilter))
            {
                var stopWatch = new Stopwatch();
                if (Config.EnableBucketDebug || Sitecore.ItemBucket.Kernel.Util.Constants.EnableTemporaryBucketDebug)
                {
                    Diagnostics.Log.Info("Start Extension Facet took : " + stopWatch.ElapsedMilliseconds + "ms",
                                         this);
                }
                stopWatch.Start();
                var returnFacets = this.GetSearch(query, GetFileExtensionsFromIndex().ToList(), searchQuery, locationFilter, baseQuery).Select(
                    facet =>
                    new FacetReturn
                        {
                            KeyName = facet.Key,
                            Value = facet.Value.ToString(),
                            Type = "extension",
                            ID = facet.Key
                        });
                if (Config.EnableBucketDebug || Sitecore.ItemBucket.Kernel.Util.Constants.EnableTemporaryBucketDebug)
                {
                    stopWatch.Stop();
                    Diagnostics.Log.Info("End Extension Facet took : " + stopWatch.ElapsedMilliseconds + "ms",
                                         this);
                }

                return returnFacets.ToList();
            }

            return new List<FacetReturn>();
        }
开发者ID:udt1106,项目名称:Sitecore-Item-Buckets,代码行数:32,代码来源:Extension.cs


示例3: AzureDirectory

        /// <summary>
        /// Create an AzureDirectory
        /// </summary>
        /// <param name="storageAccount">storage account to use</param>
        /// <param name="containerName">name of container (folder in blob storage)</param>
        /// <param name="cacheDirectory">local Directory object to use for local cache</param>
        /// <param name="rootFolder">path of the root folder inside the container</param>
        public AzureDirectory(
            CloudStorageAccount storageAccount,
            string containerName = null,
            Lucene.Net.Store.Directory cacheDirectory = null,
            bool compressBlobs = false,
            string rootFolder = null)
        {
            if (storageAccount == null)
                throw new ArgumentNullException("storageAccount");

            if (string.IsNullOrEmpty(containerName))
                _containerName = "lucene";
            else
                _containerName = containerName.ToLower();

            if (string.IsNullOrEmpty(rootFolder))
                _rootFolder = string.Empty;
            else
            {
                rootFolder = rootFolder.Trim('/');
                _rootFolder = rootFolder + "/";
            }

            _blobClient = storageAccount.CreateCloudBlobClient();
            _initCacheDirectory(cacheDirectory);
            this.CompressBlobs = compressBlobs;
        }
开发者ID:jclementson,项目名称:Examine,代码行数:34,代码来源:AzureDirectory.cs


示例4: FilteringTokenFilter

 public FilteringTokenFilter(Lucene.Net.Util.LuceneVersion version, bool enablePositionIncrements, TokenStream input)
     : this(version, input)
 {
     posIncrAtt = AddAttribute<IPositionIncrementAttribute>();
     CheckPositionIncrement(version, enablePositionIncrements);
     this.enablePositionIncrements = enablePositionIncrements;
 }
开发者ID:Cefa68000,项目名称:lucenenet,代码行数:7,代码来源:FilteringTokenFilter.cs


示例5: InitBlock

			private void  InitBlock(Lucene.Net.Index.IndexReader reader, SpanNotQuery enclosingInstance)
			{
				this.reader = reader;
				this.enclosingInstance = enclosingInstance;
				includeSpans = Enclosing_Instance.include.GetSpans(reader);
				excludeSpans = Enclosing_Instance.exclude.GetSpans(reader);
			}
开发者ID:ArsenShnurkov,项目名称:beagle-1,代码行数:7,代码来源:SpanNotQuery.cs


示例6: SecureSearcherManager

        public SecureSearcherManager(string indexName, Lucene.Net.Store.Directory directory)
            : base(directory)
        {
            IndexName = indexName;

            RegistrationBaseAddress = new Dictionary<string, Uri>();
        }
开发者ID:jinujoseph,项目名称:NuGet.Services.Metadata,代码行数:7,代码来源:SecureSearcherManager.cs


示例7: LuceneIndexingService

 public LuceneIndexingService(
     IPackageSource packageSource,
     Lucene.Net.Store.Directory directory)
 {
     _packageSource = packageSource;
     _directory = directory;
 }
开发者ID:ChrisMissal,项目名称:NuGetGallery,代码行数:7,代码来源:LuceneIndexingService.cs


示例8: FilterQueryByClasses

        public static Lucene.Net.Search.Query FilterQueryByClasses(ISet<System.Type> classesAndSubclasses, Lucene.Net.Search.Query luceneQuery)
        {
            // A query filter is more practical than a manual class filtering post query (esp on scrollable resultsets)
            // it also probably minimise the memory footprint
            if (classesAndSubclasses == null)
            {
                return luceneQuery;
            }

            BooleanQuery classFilter = new BooleanQuery();

            // annihilate the scoring impact of DocumentBuilder.CLASS_FIELDNAME
            classFilter.SetBoost(0);
            foreach (System.Type clazz in classesAndSubclasses)
            {
                Term t = new Term(DocumentBuilder.CLASS_FIELDNAME, TypeHelper.LuceneTypeName(clazz));
                TermQuery termQuery = new TermQuery(t);
                classFilter.Add(termQuery, BooleanClause.Occur.SHOULD);
            }

            BooleanQuery filteredQuery = new BooleanQuery();
            filteredQuery.Add(luceneQuery, BooleanClause.Occur.MUST);
            filteredQuery.Add(classFilter, BooleanClause.Occur.MUST);
            return filteredQuery;
        }
开发者ID:spib,项目名称:nhcontrib,代码行数:25,代码来源:FullTextSearchHelper.cs


示例9: DocIdSetAnonymousInnerClassHelper

 public DocIdSetAnonymousInnerClassHelper(QueryWrapperFilter outerInstance, Bits acceptDocs, AtomicReaderContext privateContext, Lucene.Net.Search.Weight weight)
 {
     this.OuterInstance = outerInstance;
     this.AcceptDocs = acceptDocs;
     this.PrivateContext = privateContext;
     this.Weight = weight;
 }
开发者ID:Cefa68000,项目名称:lucenenet,代码行数:7,代码来源:QueryWrapperFilter.cs


示例10: InitBlock

				private void  InitBlock(Lucene.Net.Search.StringIndex fcsi, int inclusiveLowerPoint, int inclusiveUpperPoint, AnonymousClassFieldCacheRangeFilter enclosingInstance)
				{
					this.fcsi = fcsi;
					this.inclusiveLowerPoint = inclusiveLowerPoint;
					this.inclusiveUpperPoint = inclusiveUpperPoint;
					this.enclosingInstance = enclosingInstance;
				}
开发者ID:Inzaghi2012,项目名称:teamlab.v7.5,代码行数:7,代码来源:FieldCacheRangeFilter.cs


示例11: InitBlock

			private void  InitBlock(Lucene.Net.Index.IndexWriter writerFinal, int iFinal, int iterFinal, TestThreadedOptimize enclosingInstance)
			{
				this.writerFinal = writerFinal;
				this.iFinal = iFinal;
				this.iterFinal = iterFinal;
				this.enclosingInstance = enclosingInstance;
			}
开发者ID:VirtueMe,项目名称:ravendb,代码行数:7,代码来源:TestThreadedOptimize.cs


示例12: Decorate

 /// <summary>
 /// Decorates the specified query adding context information.
 /// </summary>
 /// <param name="query">The source query.</param>
 /// <returns>The decorated query.</returns>
 public Lucene.Net.Search.Query Decorate(Lucene.Net.Search.Query query)
 {
     BooleanQuery result = new BooleanQuery(true);
       result.Add(query, Occur.MUST);
       this.AddDecorations(result);
       return result;
 }
开发者ID:HydAu,项目名称:sitecore8ecommerce,代码行数:12,代码来源:SearchContext.cs


示例13: RunQuery

 public override List<SkinnyItem> RunQuery(Lucene.Net.Search.Query query, bool showAllVersions, string sortField, bool reverse, int start, int end, out int totalResults)
 {
     using (var scope = QueryTraceHelper.GetQueryTraceScope(query))
     {
         return base.RunQuery(query, showAllVersions, sortField, reverse, start, end, out totalResults);
     }
 }
开发者ID:NetworkTen,项目名称:SitecoreSearchContrib,代码行数:7,代码来源:QueryRunnerTrace.cs


示例14: MultiIndexLockFactory

 public MultiIndexLockFactory(Lucene.Net.Store.Directory master, Lucene.Net.Store.Directory child)
 {
     if (master == null) throw new ArgumentNullException("master");
     if (child == null) throw new ArgumentNullException("child");
     _master = master;
     _child = child;
 }
开发者ID:jclementson,项目名称:Examine,代码行数:7,代码来源:MultiIndexLockFactory.cs


示例15: InitBlock

			private void  InitBlock(System.Collections.BitArray bits, int[] totalHits, Lucene.Net.Search.FieldSortedHitQueue hq, IndexSearcher enclosingInstance)
			{
				this.bits = bits;
				this.totalHits = totalHits;
				this.hq = hq;
				this.enclosingInstance = enclosingInstance;
			}
开发者ID:ArsenShnurkov,项目名称:beagle-1,代码行数:7,代码来源:IndexSearcher.cs


示例16: GetSimpleIndexer

        public static SimpleDataIndexer GetSimpleIndexer(Lucene.Net.Store.Directory luceneDir)
        {
            var i = new SimpleDataIndexer(new IndexCriteria(
                                                         new IIndexField[] { },
                                                         new[]
                                                             {
                                                                 new TestIndexField { Name = "Author" },
                                                                 new TestIndexField { Name = "DateCreated", EnableSorting = true, Type = "DateTime"  },
                                                                 new TestIndexField { Name = "Title" },
                                                                 new TestIndexField { Name = "Photographer" },
                                                                 new TestIndexField { Name = "YearCreated", Type = "Date.Year" },
                                                                 new TestIndexField { Name = "MonthCreated", Type = "Date.Month" },
                                                                 new TestIndexField { Name = "DayCreated", Type = "Date.Day" },
                                                                 new TestIndexField { Name = "HourCreated", Type = "Date.Hour" },
                                                                 new TestIndexField { Name = "MinuteCreated", Type = "Date.Minute" },
                                                                 new TestIndexField { Name = "SomeNumber", Type = "Number" },
                                                                 new TestIndexField { Name = "SomeFloat", Type = "Float" },
                                                                 new TestIndexField { Name = "SomeDouble", Type = "Double" },
                                                                 new TestIndexField { Name = "SomeLong", Type = "Long" }
                                                             },
                                                         new string[] { },
                                                         new string[] { },
                                                         -1),
                                                         luceneDir,
                                                         new StandardAnalyzer(Lucene.Net.Util.Version.LUCENE_29),
                                                         new TestSimpleDataProvider(),
                                                         new[] { "Documents", "Pictures" },
                                                         false);
            i.IndexingError += IndexingError;

            return i;
        }
开发者ID:rhayesbite,项目名称:Examine,代码行数:32,代码来源:IndexInitializer.cs


示例17: GetUmbracoIndexer

		public static UmbracoContentIndexer GetUmbracoIndexer(
            Lucene.Net.Store.Directory luceneDir, 
            Analyzer analyzer = null,
            IDataService dataService = null)
		{
            if (dataService == null)
            {
                dataService = new TestDataService();
            }

            if (analyzer == null)
            {
                analyzer = new StandardAnalyzer(Lucene.Net.Util.Version.LUCENE_29);
            }

		    var indexSet = new IndexSet();
            var indexCriteria = indexSet.ToIndexCriteria(dataService, UmbracoContentIndexer.IndexFieldPolicies);

		    var i = new UmbracoContentIndexer(indexCriteria,
		                                      luceneDir, //custom lucene directory
                                              dataService,
		                                      analyzer,
		                                      false);

			//i.IndexSecondsInterval = 1;

			i.IndexingError += IndexingError;

			return i;
		}
开发者ID:ChrisNikkel,项目名称:Umbraco-CMS,代码行数:30,代码来源:IndexInitializer.cs


示例18: InitBlock

			private void  InitBlock(int num, Lucene.Net.Index.IndexWriter writer, Lucene.Net.Store.MockRAMDirectory ramDir, TestRAMDirectory enclosingInstance)
			{
				this.num = num;
				this.writer = writer;
				this.ramDir = ramDir;
				this.enclosingInstance = enclosingInstance;
			}
开发者ID:Rationalle,项目名称:ravendb,代码行数:7,代码来源:TestRAMDirectory.cs


示例19: OnIndexEntryCreated

			public override void OnIndexEntryCreated(string entryKey, Lucene.Net.Documents.Document document)
			{
				lock (parent.DataTable)
				{
					parent.DataTable.Rows.Add(entryKey, document.GetField("Project").StringValue);
				}
			}
开发者ID:925coder,项目名称:ravendb,代码行数:7,代码来源:IndexToDataTable.cs


示例20: AddAllFields

        protected override void AddAllFields(Lucene.Net.Documents.Document document, Data.Items.Item item, bool versionSpecific)
        {
            base.AddAllFields(document, item, versionSpecific);

            if (item != null && document != null)
            {
            #if SC70
                var fieldAnalysis = Field.Index.ANALYZED;
            #else
                var fieldAnalysis = Field.Index.TOKENIZED;
            #endif

                // Sitecore 6.2 does not include template
                document.Add(new Field(Constants.Index.Fields.Template, TransformValue(item.TemplateID), Field.Store.NO, fieldAnalysis));

                // Add multilist fields
                foreach (var fieldName in m_multilistFields)
                {
                    if(item.Fields[fieldName] != null)
                        document.Add(new Field(fieldName, TransformMultilistValue(item.Fields[fieldName]), Field.Store.YES, fieldAnalysis));
                }

                // Add additional fields
                foreach (var fieldName in m_dataFieldNames)
                {
                    if (item.Fields[fieldName] != null)
                    {
                        document.Add(new Field(fieldName, TransformCSV(item.Fields[fieldName].Value), Field.Store.YES, fieldAnalysis));
                    }
                }

                // Add modified language code to deal with dash in region specific languages
                document.Add(new Field(Constants.Index.Fields.Language, TransformLanguageCode(item.Language.Name), Field.Store.NO, fieldAnalysis));
            }
        }
开发者ID:jakebz33,项目名称:WeBlog,代码行数:35,代码来源:DatabaseCrawler.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Analysis.Analyzer类代码示例发布时间:2022-05-24
下一篇:
C# LuaValue类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap