本文整理汇总了C#中Lucene.Net.Search.Filter类的典型用法代码示例。如果您正苦于以下问题:C# Filter类的具体用法?C# Filter怎么用?C# Filter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Filter类属于Lucene.Net.Search命名空间,在下文中一共展示了Filter类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例2: Hits
internal Hits(Searcher s, Query q, Filter f)
{
weight = q.Weight(s);
searcher = s;
filter = f;
GetMoreDocs(50); // retrieve 100 initially
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
}
示例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);
}
}
示例10: BrowseRequest
public BrowseRequest()
{
selections = new Dictionary<string, BrowseSelection>();
sortFields = new List<SortField>();
FacetSpecs = new Dictionary<string, FacetSpec>();
Filter = null;
FetchStoredFields = false;
}
示例11: FacetMatcher
public FacetMatcher(Filter query, IndexReader indexReader)
{
Throw.IfArgumentNull(query);
Throw.IfArgumentNull(indexReader);
this._query = query;
this._indexReader = indexReader;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}