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

C# Search.Filter类代码示例

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

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



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

示例1: ToChildBlockJoinQuery

 /// <summary>
 /// Create a ToChildBlockJoinQuery.
 /// </summary>
 /// <param name="parentQuery">Query that matches parent documents</param>
 /// <param name="parentsFilter">Filter (must produce FixedBitSet per-segment, like <see cref="FixedBitSetCachingWrapperFilter"/>) 
 /// identifying the parent documents.</param>
 /// <param name="doScores">True if parent scores should be calculated.</param>
 public ToChildBlockJoinQuery(Query parentQuery, Filter parentsFilter, bool doScores)
 {
     _origParentQuery = parentQuery;
     _parentQuery = parentQuery;
     _parentsFilter = parentsFilter;
     _doScores = doScores;
 }
开发者ID:Cefa68000,项目名称:lucenenet,代码行数:14,代码来源:ToChildBlockJoinQuery.cs


示例2: Hits

 internal Hits(Searcher s, Query q, Filter f)
 {
     weight = q.Weight(s);
     searcher = s;
     filter = f;
     GetMoreDocs(50); // retrieve 100 initially
 }
开发者ID:vineelkovvuri,项目名称:ExtendableDesktopSearch,代码行数:7,代码来源:Hits.cs


示例3: LatLongDistanceFilter

		public LatLongDistanceFilter(Filter startingFilter, double distance, double lat, double lng, string latField, string lngField) : base(startingFilter, distance)
		{
			_lat = lat;
			_lngField = lngField;
			_latField = latField;
			_lng = lng;
		}
开发者ID:VirtueMe,项目名称:ravendb,代码行数:7,代码来源:LatLongDistanceFilter.cs


示例4: BuildQuery

        /// <summary>
        /// 构建Query、Filter、Sort
        /// </summary>
        /// <param name="query"><see cref="Query"/></param>
        /// <param name="filter"><see cref="Filter"/></param>
        /// <param name="sort"><see cref="Sort"/></param>
        public void BuildQuery(out Query query, out Filter filter, out Sort sort)
        {
            BooleanQuery q = new BooleanQuery();
            foreach (var clause in clauses)
            {
                q.Add(clause);
            }
            query = q;

            if (filters.Count > 0)
            {
                BooleanQuery filterQuery = new BooleanQuery();
                foreach (var _filter in filters)
                    filterQuery.Add(_filter);

                filter = new QueryWrapperFilter(filterQuery);
            }
            else
            {
                filter = null;
            }

            if (sortFields.Count > 0)
                sort = new Sort(sortFields.ToArray());
            else
                sort = null;
        }
开发者ID:ClaytonWang,项目名称:Dw3cSNS,代码行数:33,代码来源:LuceneSearchBuilder.cs


示例5: CreateBitSet

 public static OpenBitSet CreateBitSet(IndexReader reader, Filter filter)
 {
     IndexSearcher searcher = new IndexSearcher(reader);
     OpenBitSet result = new OpenBitSet();
     searcher.Search(new MatchAllDocsQuery(), filter, new BitSetCollector(result));
     return result;
 }
开发者ID:jinujoseph,项目名称:NuGet.Services.Metadata,代码行数:7,代码来源:BitSetCollector.cs


示例6: ToParentBlockJoinSortField

 /// <summary>
 /// Create ToParentBlockJoinSortField.
 /// </summary>
 /// <param name="field"> The sort field on the nested / child level. </param>
 /// <param name="type"> The sort type on the nested / child level. </param>
 /// <param name="reverse"> Whether natural order should be reversed on the nested / child document level. </param>
 /// <param name="order"> Whether natural order should be reversed on the parent level. </param>
 /// <param name="parentFilter"> Filter that identifies the parent documents. </param>
 /// <param name="childFilter"> Filter that defines which child documents participates in sorting. </param>
 public ToParentBlockJoinSortField(string field, Type_e type, bool reverse, bool order, Filter parentFilter, Filter childFilter) 
     : base(field, type, reverse)
 {
     Order = order;
     ParentFilter = parentFilter;
     ChildFilter = childFilter;
 }
开发者ID:Cefa68000,项目名称:lucenenet,代码行数:16,代码来源:ToParentBlockJoinSortField.cs


示例7: Warm

        // ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 

        protected override void Warm(IndexSearcher searcher)
        {
            searcher.Search(new MatchAllDocsQuery(), 1);

            // Create the tenant filters
            _filters = new Dictionary<string, Filter>();
            IEnumerable<string> tenantIds = PackageTenantId.GetDistintTenantId(searcher.IndexReader);
            foreach (string tenantId in tenantIds)
            {
                _filters.Add(tenantId, new CachingWrapperFilter(new TenantFilter(tenantId)));
            }
            _publicFilter = new CachingWrapperFilter(new PublicFilter());

            _latestVersion = new CachingWrapperFilter(LatestVersionFilter.Create(searcher.IndexReader, false, false));
            _latestVersionIncludeUnlisted = new CachingWrapperFilter(LatestVersionFilter.Create(searcher.IndexReader, false, true));
            _latestVersionIncludePrerelease = new CachingWrapperFilter(LatestVersionFilter.Create(searcher.IndexReader, true, false));
            _latestVersionIncludePrereleaseIncludeUnlisted = new CachingWrapperFilter(LatestVersionFilter.Create(searcher.IndexReader, true, true));

            // Recalculate precalculated Versions arrays 
            PackageVersions packageVersions = new PackageVersions(searcher.IndexReader);
            _versionsByDoc = packageVersions.CreateVersionsLookUp(null);
            _versionListsByDoc = packageVersions.CreateVersionListsLookUp();

            // Set metadata
            LastReopen = DateTime.UtcNow;
            NumDocs = searcher.IndexReader.NumDocs();
            CommitUserData = searcher.IndexReader.CommitUserData;
        }
开发者ID:jinujoseph,项目名称:NuGet.Services.Metadata,代码行数:30,代码来源:SecureSearcherManager.cs


示例8: SearchWithFilter

        private void SearchWithFilter(IndexReader reader, Weight weight, Filter filter, Collector collector)
        {
            DocIdSet docIdSet = filter.GetDocIdSet(reader);
            if (docIdSet == null)
                return;
            Scorer scorer = weight.Scorer(reader, true, false);
            if (scorer == null)
                return;
            scorer.DocID();

            DocIdSetIterator docIdSetIterator = docIdSet.Iterator();
            if (docIdSetIterator == null)
                return;
            int target = docIdSetIterator.NextDoc();
            int num = scorer.Advance(target);
            collector.SetScorer(scorer);
            while (true)
            {
                while (num != target)
                {
                    if (num > target)
                        target = docIdSetIterator.Advance(num);
                    else
                        num = scorer.Advance(target);
                }
                if (num != DocIdSetIterator.NO_MORE_DOCS && !((GroupCollector)collector).GroupLimitReached)
                {
                    collector.Collect(num);
                    target = docIdSetIterator.NextDoc();
                    num = scorer.Advance(target);
                }
                else
                    break;
            }
        }
开发者ID:NHSChoices,项目名称:location-service,代码行数:35,代码来源:GroupedIndexSearcher.cs


示例9: SearchFiltered

        public void SearchFiltered(IndexWriter writer, Directory directory, Filter filter, bool optimize)
        {
            try
            {
                for (int i = 0; i < 60; i++)
                {//Simple docs
                    Document doc = new Document();
                    doc.Add(new Field(FIELD, i.ToString(), Field.Store.YES, Field.Index.NOT_ANALYZED));
                    writer.AddDocument(doc);
                }
                if (optimize)
                    writer.Optimize();
                writer.Close();

                BooleanQuery booleanQuery = new BooleanQuery();
                booleanQuery.Add(new TermQuery(new Term(FIELD, "36")), Occur.SHOULD);


                IndexSearcher indexSearcher = new IndexSearcher(directory);
                ScoreDoc[] hits = indexSearcher.Search(booleanQuery, filter, 1000).ScoreDocs;
                Assert.AreEqual(1, hits.Length, "Number of matched documents");

            }
            catch (System.IO.IOException e)
            {
                Assert.Fail(e.Message);
            }

        }
开发者ID:Nangal,项目名称:lucene.net,代码行数:29,代码来源:TestFilteredSearch.cs


示例10: BrowseRequest

 public BrowseRequest()
 {
     selections = new Dictionary<string, BrowseSelection>();
     sortFields = new List<SortField>();
     FacetSpecs = new Dictionary<string, FacetSpec>();
     Filter = null;
     FetchStoredFields = false;
 }
开发者ID:NightOwl888,项目名称:Bobo-Browse.Net,代码行数:8,代码来源:BrowseRequest.cs


示例11: FacetMatcher

        public FacetMatcher(Filter query, IndexReader indexReader)
        {
            Throw.IfArgumentNull(query);
            Throw.IfArgumentNull(indexReader);

            this._query = query;
            this._indexReader = indexReader;
        }
开发者ID:tucaz,项目名称:LuceneIndexManager,代码行数:8,代码来源:FacetMatcher.cs


示例12: PKIndexSplitter

 public PKIndexSplitter(Directory input, Directory dir1, Directory dir2, Filter docsInFirstIndex, IndexWriterConfig config1, IndexWriterConfig config2)
 {
     this.input = input;
     this.dir1 = dir1;
     this.dir2 = dir2;
     this.docsInFirstIndex = docsInFirstIndex;
     this.config1 = config1;
     this.config2 = config2;
 }
开发者ID:ChristopherHaws,项目名称:lucenenet,代码行数:9,代码来源:PKIndexSplitter.cs


示例13: ConstantScoreQuery

 /// <summary>
 /// Wraps a Filter as a Query. The hits will get a constant score
 /// dependent on the boost factor of this query.
 /// If you simply want to strip off scores from a Query, no longer use
 /// {@code new ConstantScoreQuery(new QueryWrapperFilter(query))}, instead
 /// use <seealso cref="#ConstantScoreQuery(Query)"/>!
 /// </summary>
 public ConstantScoreQuery(Filter filter)
 {
     if (filter == null)
     {
         throw new System.NullReferenceException("Filter may not be null");
     }
     this.filter = filter;
     this.query = null;
 }
开发者ID:Cefa68000,项目名称:lucenenet,代码行数:16,代码来源:ConstantScoreQuery.cs


示例14: Hits

		public /*internal*/ bool debugCheckedForDeletions = false; // for test purposes.
		
		internal Hits(Searcher s, Query q, Filter f)
		{
			weight = q.Weight(s);
			searcher = s;
			filter = f;
			nDeletions = CountDeletions(s);
			GetMoreDocs(50); // retrieve 100 initially
			lengthAtStart = length;
		}
开发者ID:vikasraz,项目名称:indexsearchutils,代码行数:11,代码来源:Hits.cs


示例15: DisjointSpatialFilter

        /// <param name="strategy">Needed to compute intersects</param>
        /// <param name="args">Used in spatial intersection</param>
        /// <param name="field">
        /// This field is used to determine which docs have spatial data via
        /// <see cref="FieldCache.GetDocsWithField(AtomicReader, string)"/>.
        /// Passing null will assume all docs have spatial data.
        /// </param>
        public DisjointSpatialFilter(SpatialStrategy strategy, SpatialArgs args, string field)
        {
            this.field = field;

            // TODO consider making SpatialArgs cloneable
            SpatialOperation origOp = args.Operation; //copy so we can restore
            args.Operation = SpatialOperation.Intersects; //temporarily set to intersects
            intersectsFilter = strategy.MakeFilter(args);
            args.Operation = origOp;
        }
开发者ID:apache,项目名称:lucenenet,代码行数:17,代码来源:DisjointSpatialFilter.cs


示例16: TstFilterCard

 private void TstFilterCard(String mes, int expected, Filter filt)
 {
     DocIdSetIterator disi = filt.GetDocIdSet(reader).Iterator();
     int actual = 0;
     while (disi.NextDoc() != DocIdSetIterator.NO_MORE_DOCS)
     {
         actual++;
     }
     Assert.AreEqual(expected, actual, mes);
 }
开发者ID:synhershko,项目名称:lucene.net,代码行数:10,代码来源:BooleanFilterTest.cs


示例17: ValueSourceFilter

 public ValueSourceFilter(Filter startingFilter, ValueSource source, double min, double max)
 {
     if (startingFilter == null)
     {
         throw new ArgumentException("please provide a non-null startingFilter; you can use QueryWrapperFilter(MatchAllDocsQuery) as a no-op filter", "startingFilter");
     }
     this.startingFilter = startingFilter;
     this.source = source;
     this.min = min;
     this.max = max;
 }
开发者ID:Cefa68000,项目名称:lucenenet,代码行数:11,代码来源:ValueSourceFilter.cs


示例18: End

        public void End(IndexReader indexReader)
        {
            foreach (Tuple<NuGetVersion, string, int> entry in _lookup.Values)
            {
                string readerName = entry.Item2;
                int readerDocumentId = entry.Item3;

                _openBitSetLookup[readerName].Set(readerDocumentId);
            }

            Result = new OpenBitSetLookupFilter(_openBitSetLookup);
        }
开发者ID:NuGet,项目名称:NuGet.Services.Metadata,代码行数:12,代码来源:LatestListedHandler.cs


示例19: LuceneQueryStatistics

 public LuceneQueryStatistics(Query query, Filter filter, Sort sort, TimeSpan elapsedPreparationTime, TimeSpan elapsedSearchTime, TimeSpan elapsedRetrievalTime, int totalHits, int skippedHits, int retrievedDocuments)
 {
     this.totalHits = totalHits;
     this.query = query;
     this.filter = filter;
     this.sort = sort;
     this.elapsedPreparationTime = elapsedPreparationTime;
     this.elapsedSearchTime = elapsedSearchTime;
     this.elapsedRetrievalTime = elapsedRetrievalTime;
     this.skippedHits = skippedHits;
     this.retrievedDocuments = retrievedDocuments;
 }
开发者ID:Zaixu,项目名称:Lucene.Net.Linq,代码行数:12,代码来源:LuceneQueryStatistics.cs


示例20: AssertFilterEquals

 private void AssertFilterEquals(Filter f1, Filter f2)
 {
     Query query = new MatchAllDocsQuery();
     TopDocs hits1 = @is.Search(query, f1, Ir.MaxDoc());
     TopDocs hits2 = @is.Search(query, f2, Ir.MaxDoc());
     Assert.AreEqual(hits1.TotalHits, hits2.TotalHits);
     CheckHits.CheckEqual(query, hits1.ScoreDocs, hits2.ScoreDocs);
     // now do it again to confirm caching works
     TopDocs hits3 = @is.Search(query, f1, Ir.MaxDoc());
     TopDocs hits4 = @is.Search(query, f2, Ir.MaxDoc());
     Assert.AreEqual(hits3.TotalHits, hits4.TotalHits);
     CheckHits.CheckEqual(query, hits3.ScoreDocs, hits4.ScoreDocs);
 }
开发者ID:joyanta,项目名称:lucene.net,代码行数:13,代码来源:TestCachingWrapperFilter.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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