本文整理汇总了C#中Transformalize.Libs.Lucene.Net.Index.IndexReader类的典型用法代码示例。如果您正苦于以下问题:C# IndexReader类的具体用法?C# IndexReader怎么用?C# IndexReader使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IndexReader类属于Transformalize.Libs.Lucene.Net.Index命名空间,在下文中一共展示了IndexReader类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SegmentMergeInfo
internal SegmentMergeInfo(int b, TermEnum te, IndexReader r)
{
base_Renamed = b;
reader = r;
termEnum = te;
term = te.Term;
}
示例2: SubReader
/// <summary> Returns sub-reader subIndex from reader.
///
/// </summary>
/// <param name="reader">parent reader
/// </param>
/// <param name="subIndex">index of desired sub reader
/// </param>
/// <returns> the subreader at subINdex
/// </returns>
public static IndexReader SubReader(IndexReader reader, int subIndex)
{
var subReadersList = new System.Collections.Generic.List<IndexReader>();
ReaderUtil.GatherSubReaders(subReadersList, reader);
IndexReader[] subReaders = subReadersList.ToArray();
return subReaders[subIndex];
}
示例3: MatchAllScorer
internal MatchAllScorer(MatchAllDocsQuery enclosingInstance, IndexReader reader, Similarity similarity, Weight w, byte[] norms):base(similarity)
{
InitBlock(enclosingInstance);
this.termDocs = reader.TermDocs(null);
score = w.Value;
this.norms = norms;
}
示例4: Initialize
private void Initialize(IndexReader[] subReaders, bool closeSubReaders)
{
// Deep copy
this.subReaders = subReaders.ToArray();
starts = new int[subReaders.Length + 1]; // build starts array
decrefOnClose = new bool[subReaders.Length];
for (int i = 0; i < subReaders.Length; i++)
{
starts[i] = maxDoc;
maxDoc += subReaders[i].MaxDoc; // compute maxDocs
if (!closeSubReaders)
{
subReaders[i].IncRef();
decrefOnClose[i] = true;
}
else
{
decrefOnClose[i] = false;
}
if (subReaders[i].HasDeletions)
hasDeletions = true;
}
starts[subReaders.Length] = maxDoc;
}
示例5: TermRangeTermEnum
/// <summary> Enumerates all terms greater/equal than <c>lowerTerm</c>
/// but less/equal than <c>upperTerm</c>.
///
/// If an endpoint is null, it is said to be "open". Either or both
/// endpoints may be open. Open endpoints may not be exclusive
/// (you can't select all but the first or last term without
/// explicitly specifying the term to exclude.)
///
/// </summary>
/// <param name="reader">
/// </param>
/// <param name="field">An interned field that holds both lower and upper terms.
/// </param>
/// <param name="lowerTermText">The term text at the lower end of the range
/// </param>
/// <param name="upperTermText">The term text at the upper end of the range
/// </param>
/// <param name="includeLower">If true, the <c>lowerTerm</c> is included in the range.
/// </param>
/// <param name="includeUpper">If true, the <c>upperTerm</c> is included in the range.
/// </param>
/// <param name="collator">The collator to use to collate index Terms, to determine their
/// membership in the range bounded by <c>lowerTerm</c> and
/// <c>upperTerm</c>.
///
/// </param>
/// <throws> IOException </throws>
public TermRangeTermEnum(IndexReader reader, System.String field, System.String lowerTermText, System.String upperTermText, bool includeLower, bool includeUpper, System.Globalization.CompareInfo collator)
{
this.collator = collator;
this.upperTermText = upperTermText;
this.lowerTermText = lowerTermText;
this.includeLower = includeLower;
this.includeUpper = includeUpper;
this.field = StringHelper.Intern(field);
// do a little bit of normalization...
// open ended range queries should always be inclusive.
if (this.lowerTermText == null)
{
this.lowerTermText = "";
this.includeLower = true;
}
if (this.upperTermText == null)
{
this.includeUpper = true;
}
System.String startTermText = collator == null?this.lowerTermText:"";
SetEnum(reader.Terms(new Term(this.field, startTermText)));
}
示例6: Purge
// lucene.net: java version 3.0.3 with patch in rev. 912330 applied:
// uschindler 21/02/2010 12:16:42 LUCENE-2273: Fixed bug in FieldCacheImpl.getCacheEntries() that used
// WeakHashMap incorrectly and lead to ConcurrentModificationException
public void Purge(IndexReader r)
{
lock (this)
{
foreach (Cache c in caches.Values)
{
c.Purge(r);
}
}
}
示例7: Explain
public override Explanation Explain(IndexReader reader, int doc)
{
ComplexExplanation result = new ComplexExplanation();
result.Description = "weight(" + Query + " in " + doc + "), product of:";
System.String field = ((SpanQuery) Query).Field;
Explanation idfExpl = new Explanation(idf, "idf(" + field + ": " + idfExp.Explain() + ")");
// explain query weight
Explanation queryExpl = new Explanation();
queryExpl.Description = "queryWeight(" + Query + "), product of:";
Explanation boostExpl = new Explanation(Query.Boost, "boost");
if (Query.Boost != 1.0f)
queryExpl.AddDetail(boostExpl);
queryExpl.AddDetail(idfExpl);
Explanation queryNormExpl = new Explanation(queryNorm, "queryNorm");
queryExpl.AddDetail(queryNormExpl);
queryExpl.Value = boostExpl.Value * idfExpl.Value * queryNormExpl.Value;
result.AddDetail(queryExpl);
// explain field weight
ComplexExplanation fieldExpl = new ComplexExplanation();
fieldExpl.Description = "fieldWeight(" + field + ":" + internalQuery.ToString(field) + " in " + doc + "), product of:";
Explanation tfExpl = ((SpanScorer)Scorer(reader, true, false)).Explain(doc);
fieldExpl.AddDetail(tfExpl);
fieldExpl.AddDetail(idfExpl);
Explanation fieldNormExpl = new Explanation();
byte[] fieldNorms = reader.Norms(field);
float fieldNorm = fieldNorms != null?Similarity.DecodeNorm(fieldNorms[doc]):1.0f;
fieldNormExpl.Value = fieldNorm;
fieldNormExpl.Description = "fieldNorm(field=" + field + ", doc=" + doc + ")";
fieldExpl.AddDetail(fieldNormExpl);
fieldExpl.Match = tfExpl.IsMatch;
fieldExpl.Value = tfExpl.Value * idfExpl.Value * fieldNormExpl.Value;
result.AddDetail(fieldExpl);
System.Boolean? tempAux = fieldExpl.Match;
result.Match = tempAux;
// combine them
result.Value = queryExpl.Value * fieldExpl.Value;
if (queryExpl.Value == 1.0f)
return fieldExpl;
return result;
}
示例8: GetEnum
protected internal override FilteredTermEnum GetEnum(IndexReader reader)
{
if (_termContainsWildcard)
{
return new WildcardTermEnum(reader, Term);
}
else
{
return new SingleTermEnum(reader, Term);
}
}
示例9: Rewrite
public override Query Rewrite(IndexReader reader)
{
if (_termIsPrefix)
{
MultiTermQuery rewritten =
new PrefixQuery(internalTerm.CreateTerm(internalTerm.Text.Substring(0, internalTerm.Text.IndexOf('*'))));
rewritten.Boost = Boost;
rewritten.RewriteMethod = RewriteMethod;
return rewritten;
}
else
{
return base.Rewrite(reader);
}
}
示例10: GatherSubReaders
/// <summary>Gathers sub-readers from reader into a List.</summary>
/// <param name="allSubReaders"></param>
/// <param name="reader"></param>
public static void GatherSubReaders(System.Collections.Generic.IList<IndexReader> allSubReaders, IndexReader reader)
{
IndexReader[] subReaders = reader.GetSequentialSubReaders();
if (subReaders == null)
{
// Add the reader itself, and do not recurse
allSubReaders.Add(reader);
}
else
{
for (int i = 0; i < subReaders.Length; i++)
{
GatherSubReaders(allSubReaders, subReaders[i]);
}
}
}
示例11: BitSpans
public override SpanFilterResult BitSpans(IndexReader reader)
{
OpenBitSet bits = new OpenBitSet(reader.MaxDoc);
Lucene.Net.Search.Spans.Spans spans = internalQuery.GetSpans(reader);
IList<SpanFilterResult.PositionInfo> tmp = new List<SpanFilterResult.PositionInfo>(20);
int currentDoc = - 1;
SpanFilterResult.PositionInfo currentInfo = null;
while (spans.Next())
{
int doc = spans.Doc();
bits.Set(doc);
if (currentDoc != doc)
{
currentInfo = new SpanFilterResult.PositionInfo(doc);
tmp.Add(currentInfo);
currentDoc = doc;
}
currentInfo.AddPosition(spans.Start(), spans.End());
}
return new SpanFilterResult(bits, tmp);
}
示例12: Rewrite
/*(non-Javadoc) <see cref="Lucene.Net.Search.Query.rewrite(Lucene.Net.Index.IndexReader) */
public override Query Rewrite(IndexReader reader)
{
CustomScoreQuery clone = null;
Query sq = subQuery.Rewrite(reader);
if (sq != subQuery)
{
clone = (CustomScoreQuery)Clone();
clone.subQuery = sq;
}
for (int i = 0; i < valSrcQueries.Length; i++)
{
ValueSourceQuery v = (ValueSourceQuery)valSrcQueries[i].Rewrite(reader);
if (v != valSrcQueries[i])
{
if (clone == null) clone = (CustomScoreQuery)Clone();
clone.valSrcQueries[i] = v;
}
}
return (clone == null) ? this : clone;
}
示例13: WildcardTermEnum
/// <summary> Creates a new <c>WildcardTermEnum</c>.
/// <p/>
/// After calling the constructor the enumeration is already pointing to the first
/// valid term if such a term exists.
/// </summary>
public WildcardTermEnum(IndexReader reader, Term term):base()
{
searchTerm = term;
field = searchTerm.Field;
System.String searchTermText = searchTerm.Text;
int sidx = searchTermText.IndexOf((System.Char) WILDCARD_STRING);
int cidx = searchTermText.IndexOf((System.Char) WILDCARD_CHAR);
int idx = sidx;
if (idx == - 1)
{
idx = cidx;
}
else if (cidx >= 0)
{
idx = System.Math.Min(idx, cidx);
}
pre = idx != - 1?searchTerm.Text.Substring(0, (idx) - (0)):"";
preLen = pre.Length;
text = searchTermText.Substring(preLen);
SetEnum(reader.Terms(new Term(searchTerm.Field, pre)));
}
示例14: GetValues
/*(non-Javadoc) <see cref="Lucene.Net.Search.Function.ValueSource.getValues(Lucene.Net.Index.IndexReader) */
public override DocValues GetValues(IndexReader reader)
{
int[] arr = Lucene.Net.Search.FieldCache_Fields.DEFAULT.GetStringIndex(reader, field).order;
return new AnonymousClassDocValues(arr, this);
}
示例15: GetDocIdSet
public override DocIdSet GetDocIdSet(IndexReader reader)
{
return new FieldCacheTermsFilterDocIdSet(this, FieldCache.GetStringIndex(reader, field));
}