本文整理汇总了C#中Monodoc类的典型用法代码示例。如果您正苦于以下问题:C# Monodoc类的具体用法?C# Monodoc怎么用?C# Monodoc使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Monodoc类属于命名空间,在下文中一共展示了Monodoc类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Bits
public override System.Collections.BitArray Bits(Monodoc.Lucene.Net.Index.IndexReader reader)
{
if (cache == null)
{
cache = new System.Collections.Hashtable();
}
lock (cache.SyncRoot)
{
// check cache
System.Collections.BitArray cached = (System.Collections.BitArray) cache[reader];
if (cached != null)
{
return cached;
}
}
System.Collections.BitArray bits = filter.Bits(reader);
lock (cache.SyncRoot)
{
// update cache
cache[reader] = bits;
}
return bits;
}
示例2: InitBlock
private void InitBlock(System.Collections.BitArray bits, int[] totalHits, Monodoc.Lucene.Net.Search.FieldSortedHitQueue hq, IndexSearcher enclosingInstance)
{
this.bits = bits;
this.totalHits = totalHits;
this.hq = hq;
this.enclosingInstance = enclosingInstance;
}
示例3: Bits
public override System.Collections.BitArray Bits(Monodoc.Lucene.Net.Index.IndexReader reader)
{
if (cache == null)
{
cache = new System.Collections.Hashtable();
}
lock (cache.SyncRoot)
{
// check cache
System.Collections.BitArray cached = (System.Collections.BitArray) cache[reader];
if (cached != null)
{
return cached;
}
}
System.Collections.BitArray bits = new System.Collections.BitArray((reader.MaxDoc() % 64 == 0?reader.MaxDoc() / 64:reader.MaxDoc() / 64 + 1) * 64);
new IndexSearcher(reader).Search(query, new AnonymousClassHitCollector(bits, this));
lock (cache.SyncRoot)
{
// update cache
cache[reader] = bits;
}
return bits;
}
示例4: InitBlock
private void InitBlock(Monodoc.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);
}
示例5: Rewrite
public override Query Rewrite(Monodoc.Lucene.Net.Index.IndexReader reader)
{
BooleanQuery query = new BooleanQuery();
TermEnum enumerator = reader.Terms(prefix);
try
{
System.String prefixText = prefix.Text();
System.String prefixField = prefix.Field();
do
{
Term term = enumerator.Term();
if (term != null && term.Text().StartsWith(prefixText) && (System.Object) term.Field() == (System.Object) prefixField)
{
TermQuery tq = new TermQuery(term); // found a match
tq.SetBoost(GetBoost()); // set the boost
query.Add(tq, false, false); // add to query
//System.out.println("added " + term);
}
else
{
break;
}
}
while (enumerator.Next());
}
finally
{
enumerator.Close();
}
return query;
}
示例6: MultiSearcher
/// <summary>Creates a searcher which searches <i>searchables</i>. </summary>
public MultiSearcher(Monodoc.Lucene.Net.Search.Searchable[] searchables)
{
this.searchables = searchables;
starts = new int[searchables.Length + 1]; // build starts array
for (int i = 0; i < searchables.Length; i++)
{
starts[i] = maxDoc;
maxDoc += searchables[i].MaxDoc(); // compute maxDocs
}
starts[searchables.Length] = maxDoc;
}
示例7: InitBlock
private void InitBlock(Monodoc.Lucene.Net.Index.IndexReader reader, SpanOrQuery enclosingInstance)
{
this.reader = reader;
this.enclosingInstance = enclosingInstance;
all = new System.Collections.ArrayList(Enclosing_Instance.clauses.Count);
queue = new SpanQueue(enclosingInstance, Enclosing_Instance.clauses.Count);
System.Collections.IEnumerator i = Enclosing_Instance.clauses.GetEnumerator();
while (i.MoveNext())
{
// initialize all
all.Add(((SpanQuery) i.Current).GetSpans(reader));
}
}
示例8: Initialize
private void Initialize(Monodoc.Lucene.Net.Index.IndexReader[] subReaders)
{
this.subReaders = subReaders;
starts = new int[subReaders.Length + 1]; // build starts array
for (int i = 0; i < subReaders.Length; i++)
{
starts[i] = maxDoc;
maxDoc += subReaders[i].MaxDoc(); // compute maxDocs
if (subReaders[i].HasDeletions())
hasDeletions = true;
}
starts[subReaders.Length] = maxDoc;
}
示例9: Rewrite
/// <summary> FIXME: Describe <code>rewrite</code> method here.
///
/// </summary>
/// <param name="reader">an <code>Monodoc.Lucene.Net.Index.IndexReader</code> value
/// </param>
/// <returns> a <code>Query</code> value
/// </returns>
/// <exception cref=""> IOException if an error occurs
/// </exception>
public override Query Rewrite(Monodoc.Lucene.Net.Index.IndexReader reader)
{
BooleanQuery query = new BooleanQuery();
TermEnum enumerator = reader.Terms(lowerTerm);
try
{
bool checkLower = false;
if (!inclusive)
// make adjustments to set to exclusive
checkLower = true;
System.String testField = GetField();
do
{
Term term = enumerator.Term();
if (term != null && (System.Object) term.Field() == (System.Object) testField)
{
if (!checkLower || String.CompareOrdinal(term.Text(), lowerTerm.Text()) > 0)
{
checkLower = false;
if (upperTerm != null)
{
int compare = String.CompareOrdinal(upperTerm.Text(), term.Text());
/* if beyond the upper term, or is exclusive and
* this is equal to the upper term, break out */
if ((compare < 0) || (!inclusive && compare == 0))
break;
}
TermQuery tq = new TermQuery(term); // found a match
tq.SetBoost(GetBoost()); // set the boost
query.Add(tq, false, false); // add to query
}
}
else
{
break;
}
}
while (enumerator.Next());
}
finally
{
enumerator.Close();
}
return query;
}
示例10: SegmentMergeInfo
internal int[] docMap = null; // maps around deleted docs
internal SegmentMergeInfo(int b, TermEnum te, Monodoc.Lucene.Net.Index.IndexReader r)
{
base_Renamed = b;
reader = r;
termEnum = te;
term = te.Term();
postings = reader.TermPositions();
// build array which maps document numbers around deletions
if (reader.HasDeletions())
{
int maxDoc = reader.MaxDoc();
docMap = new int[maxDoc];
int j = 0;
for (int i = 0; i < maxDoc; i++)
{
if (reader.IsDeleted(i))
docMap[i] = - 1;
else
docMap[i] = j++;
}
}
}
示例11: WildcardTermEnum
/// <summary> Creates a new <code>WildcardTermEnum</code>. Passing in a
/// {@link Monodoc.Lucene.Net.Index.Term Term} that does not contain a
/// <code>WILDCARD_CHAR</code> will cause an exception to be thrown.
/// </summary>
public WildcardTermEnum(Monodoc.Lucene.Net.Index.IndexReader reader, Term term):base()
{
searchTerm = term;
field = searchTerm.Field();
text = searchTerm.Text();
int sidx = text.IndexOf((System.Char) WILDCARD_STRING);
int cidx = text.IndexOf((System.Char) WILDCARD_CHAR);
int idx = sidx;
if (idx == - 1)
{
idx = cidx;
}
else if (cidx >= 0)
{
idx = System.Math.Min(idx, cidx);
}
pre = searchTerm.Text().Substring(0, (idx) - (0));
preLen = pre.Length;
text = text.Substring(preLen);
SetEnum(reader.Terms(new Term(searchTerm.Field(), pre)));
}
示例12: Rewrite
public override Query Rewrite(Monodoc.Lucene.Net.Index.IndexReader reader)
{
FilteredTermEnum enumerator = GetEnum(reader);
BooleanQuery query = new BooleanQuery();
try
{
do
{
Term t = enumerator.Term();
if (t != null)
{
TermQuery tq = new TermQuery(t); // found a match
tq.SetBoost(GetBoost() * enumerator.Difference()); // set the boost
query.Add(tq, false, false); // add to query
}
}
while (enumerator.Next());
}
finally
{
enumerator.Close();
}
return query;
}
示例13: AnonymousClassSpans
public AnonymousClassSpans(Monodoc.Lucene.Net.Index.IndexReader reader, SpanOrQuery enclosingInstance)
{
InitBlock(reader, enclosingInstance);
}
示例14: GetSpans
public override Spans GetSpans(Monodoc.Lucene.Net.Index.IndexReader reader)
{
if (clauses.Count == 1)
// optimize 1-clause case
return ((SpanQuery) clauses[0]).GetSpans(reader);
return new AnonymousClassSpans(reader, this);
}
示例15: Explain
public virtual Explanation Explain(Monodoc.Lucene.Net.Index.IndexReader reader, int doc)
{
Explanation result = new Explanation();
result.SetDescription("weight(" + Query + " in " + doc + "), product of:");
Explanation idfExpl = new Explanation(idf, "idf(" + Query + ")");
// explain query weight
Explanation queryExpl = new Explanation();
queryExpl.SetDescription("queryWeight(" + Query + "), product of:");
Explanation boostExpl = new Explanation(Enclosing_Instance.GetBoost(), "boost");
if (Enclosing_Instance.GetBoost() != 1.0f)
queryExpl.AddDetail(boostExpl);
queryExpl.AddDetail(idfExpl);
Explanation queryNormExpl = new Explanation(queryNorm, "queryNorm");
queryExpl.AddDetail(queryNormExpl);
queryExpl.SetValue(boostExpl.GetValue() * idfExpl.GetValue() * queryNormExpl.GetValue());
result.AddDetail(queryExpl);
// explain Field weight
Explanation fieldExpl = new Explanation();
fieldExpl.SetDescription("fieldWeight(" + Query + " in " + doc + "), product of:");
Explanation tfExpl = Scorer(reader).Explain(doc);
fieldExpl.AddDetail(tfExpl);
fieldExpl.AddDetail(idfExpl);
Explanation fieldNormExpl = new Explanation();
byte[] fieldNorms = reader.Norms(Enclosing_Instance.field);
float fieldNorm = fieldNorms != null?Similarity.DecodeNorm(fieldNorms[doc]):0.0f;
fieldNormExpl.SetValue(fieldNorm);
fieldNormExpl.SetDescription("fieldNorm(Field=" + Enclosing_Instance.field + ", doc=" + doc + ")");
fieldExpl.AddDetail(fieldNormExpl);
fieldExpl.SetValue(tfExpl.GetValue() * idfExpl.GetValue() * fieldNormExpl.GetValue());
result.AddDetail(fieldExpl);
// combine them
result.SetValue(queryExpl.GetValue() * fieldExpl.GetValue());
if (queryExpl.GetValue() == 1.0f)
return fieldExpl;
return result;
}