本文整理汇总了C#中Lucene.Net.Index.IndexReader类的典型用法代码示例。如果您正苦于以下问题:C# Lucene.Net.Index.IndexReader类的具体用法?C# Lucene.Net.Index.IndexReader怎么用?C# Lucene.Net.Index.IndexReader使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Lucene.Net.Index.IndexReader类属于命名空间,在下文中一共展示了Lucene.Net.Index.IndexReader类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: SetUp
public override void SetUp()
{
base.SetUp();
RAMDirectory directory = new RAMDirectory();
IndexWriter writer = new IndexWriter(directory, new WhitespaceAnalyzer(), true, IndexWriter.MaxFieldLength.LIMITED);
long theLong = System.Int64.MaxValue;
double theDouble = System.Double.MaxValue;
sbyte theByte = (sbyte) System.SByte.MaxValue;
short theShort = System.Int16.MaxValue;
int theInt = System.Int32.MaxValue;
float theFloat = System.Single.MaxValue;
for (int i = 0; i < NUM_DOCS; i++)
{
Document doc = new Document();
doc.Add(new Field("theLong", System.Convert.ToString(theLong--), Field.Store.NO, Field.Index.NOT_ANALYZED));
doc.Add(new Field("theDouble", (theDouble--).ToString("E16"), Field.Store.NO, Field.Index.NOT_ANALYZED));
doc.Add(new Field("theByte", System.Convert.ToString((sbyte) theByte--), Field.Store.NO, Field.Index.NOT_ANALYZED));
doc.Add(new Field("theShort", System.Convert.ToString(theShort--), Field.Store.NO, Field.Index.NOT_ANALYZED));
doc.Add(new Field("theInt", System.Convert.ToString(theInt--), Field.Store.NO, Field.Index.NOT_ANALYZED));
doc.Add(new Field("theFloat", (theFloat--).ToString("E8"), Field.Store.NO, Field.Index.NOT_ANALYZED));
writer.AddDocument(doc);
}
writer.Close();
reader = IndexReader.Open(directory);
}
开发者ID:Rationalle,项目名称:ravendb,代码行数:25,代码来源:TestFieldCache.cs
示例2: Bits
public override System.Collections.BitArray Bits(IndexReader reader)
{
System.Collections.BitArray bitset = new System.Collections.BitArray((5 % 64 == 0?5 / 64:5 / 64 + 1) * 64);
bitset.Set(1, true);
bitset.Set(3, true);
return bitset;
}
开发者ID:runefs,项目名称:Marvin,代码行数:7,代码来源:TestFilteredQuery.cs
示例3: GetDocIdSet
public override DocIdSet GetDocIdSet(IndexReader reader)
{
System.Collections.BitArray bitset = new System.Collections.BitArray((5 % 64 == 0?5 / 64:5 / 64 + 1) * 64);
bitset.Set(1, true);
bitset.Set(3, true);
return new DocIdBitSet(bitset);
}
开发者ID:Rationalle,项目名称:ravendb,代码行数:7,代码来源:TestFilteredQuery.cs
示例4: GetDocIdSet
public override DocIdSet GetDocIdSet(IndexReader reader)
{
if (cache == null)
{
cache = new System.Collections.Hashtable();
}
lock (cache.SyncRoot)
{
// check cache
DocIdSet cached = (DocIdSet) cache[reader];
if (shouldHaveCache)
{
Assert.IsNotNull(cached, "Cache should have data ");
}
else
{
Assert.IsNotNull( cached, "Cache should be null " + cached);
}
if (cached != null)
{
return cached;
}
}
DocIdSet bits = filter.GetDocIdSet(reader);
lock (cache.SyncRoot)
{
// update cache
cache[reader] = bits;
}
return bits;
}
开发者ID:Rationalle,项目名称:ravendb,代码行数:35,代码来源:CachingWrapperFilterHelper.cs
示例5: 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];
}
开发者ID:modulexcite,项目名称:Xamarin-Lucene.Net,代码行数:16,代码来源:ReaderUtil.cs
示例6: Rewrite
public override Query Rewrite(IndexReader reader)
{
Query orig = new RegexQuery(term).Rewrite(reader);
// RegexQuery (via MultiTermQuery).rewrite always returns a BooleanQuery
BooleanQuery bq = (BooleanQuery) orig;
BooleanClause[] clauses = bq.GetClauses();
SpanQuery[] sqs = new SpanQuery[clauses.Length];
for (int i = 0; i < clauses.Length; i++)
{
BooleanClause clause = clauses[i];
// Clauses from RegexQuery.rewrite are always TermQuery's
TermQuery tq = (TermQuery) clause.GetQuery();
sqs[i] = new SpanTermQuery(tq.GetTerm());
sqs[i].SetBoost(tq.GetBoost());
}
SpanOrQuery query = new SpanOrQuery(sqs);
query.SetBoost(orig.GetBoost());
return query;
}
开发者ID:ArsenShnurkov,项目名称:beagle-1,代码行数:25,代码来源:SpanRegexQuery.cs
示例7: Rewrite
public override Query Rewrite(IndexReader reader)
{
if (!termContainsWildcard)
return new TermQuery(GetTerm());
else
return base.Rewrite(reader);
}
开发者ID:Inzaghi2012,项目名称:teamlab.v7.5,代码行数:7,代码来源:WildcardQuery.cs
示例8: Bits
public override System.Collections.BitArray Bits(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;
}
开发者ID:karino2,项目名称:wikipediaconv,代码行数:29,代码来源:QueryFilter.cs
示例9: Rewrite
public override Query Rewrite(IndexReader reader)
{
BooleanQuery query = new BooleanQuery(true);
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) && term.Field() == prefixField)
{
TermQuery tq = new TermQuery(term); // found a match
tq.SetBoost(GetBoost()); // set the boost
query.Add(tq, BooleanClause.Occur.SHOULD); // add to query
//System.out.println("added " + term);
}
else
{
break;
}
}
while (enumerator.Next());
}
finally
{
enumerator.Close();
}
return query;
}
开发者ID:kiichi7,项目名称:Search-Engine,代码行数:31,代码来源:PrefixQuery.cs
示例10: Bits
public override System.Collections.BitArray Bits(IndexReader reader)
{
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));
return bits;
}
开发者ID:vikasraz,项目名称:indexsearchutils,代码行数:7,代码来源:QueryWrapperFilter.cs
示例11: Purge
public void Purge(IndexReader r)
{
foreach (Cache c in caches.Values)
{
c.Purge(r);
}
}
开发者ID:Mpdreamz,项目名称:lucene.net,代码行数:7,代码来源:FieldCacheImpl.cs
示例12: NewComparator
// inherit javadocs
public virtual ScoreDocComparator NewComparator(IndexReader reader, System.String fieldname)
{
System.String field = String.Intern(fieldname);
System.IComparable[] cachedValues = Lucene.Net.Search.FieldCache_Fields.DEFAULT.GetCustom(reader, field, this);
return new AnonymousClassScoreDocComparator(cachedValues, this);
}
开发者ID:vikasraz,项目名称:indexsearchutils,代码行数:8,代码来源:SortComparator.cs
示例13: SetUp
public override void SetUp()
{
base.SetUp();
PayloadHelper helper = new PayloadHelper();
searcher = helper.SetUp(similarity, 1000);
indexReader = searcher.GetIndexReader();
}
开发者ID:kstenson,项目名称:NHibernate.Search,代码行数:7,代码来源:TestPayloadSpans.cs
示例14: CreateValue
protected internal override System.Object CreateValue(IndexReader reader, System.Object entryKey)
{
Entry entry = (Entry) entryKey;
System.String field = entry.field;
LongParser parser = (LongParser) entry.custom;
long[] retArray = new long[reader.MaxDoc()];
TermDocs termDocs = reader.TermDocs();
TermEnum termEnum = reader.Terms(new Term(field, ""));
try
{
do
{
Term term = termEnum.Term();
if (term == null || (System.Object) term.Field() != (System.Object) field)
break;
long termval = parser.ParseLong(term.Text());
termDocs.Seek(termEnum);
while (termDocs.Next())
{
retArray[termDocs.Doc()] = termval;
}
}
while (termEnum.Next());
}
finally
{
termDocs.Close();
termEnum.Close();
}
return retArray;
}
开发者ID:vikasraz,项目名称:indexsearchutils,代码行数:31,代码来源:ExtendedFieldCacheImpl.cs
示例15: MatchAllScorer
internal MatchAllScorer(MatchAllDocsQuery enclosingInstance, IndexReader reader, Similarity similarity, Weight w, byte[] norms):base(similarity)
{
InitBlock(enclosingInstance);
this.termDocs = reader.TermDocs(null);
score = w.GetValue();
this.norms = norms;
}
开发者ID:kstenson,项目名称:NHibernate.Search,代码行数:7,代码来源:MatchAllDocsQuery.cs
示例16: Bits
public override System.Collections.BitArray Bits(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;
}
开发者ID:zweib730,项目名称:beagrep,代码行数:27,代码来源:CachingWrapperFilter.cs
示例17: RegexTermEnum
public RegexTermEnum(IndexReader reader, Term term)
: base()
{
field = term.Field();
System.String text = term.Text();
pattern = new Pattern(text);
// Find the first regex character position, to find the
// maximum prefix to use for term enumeration
int index = 0;
while (index < text.Length)
{
char c = text[index];
if (!System.Char.IsLetterOrDigit(c))
break;
index++;
}
pre = text.Substring(0, (index) - (0));
SetEnum(reader.Terms(new Term(term.Field(), pre)));
}
开发者ID:karino2,项目名称:wikipediaconv,代码行数:25,代码来源:RegexTermEnum.cs
示例18: MatchAllScorer
internal MatchAllScorer(MatchAllDocsQuery enclosingInstance, IndexReader reader, Similarity similarity) : base(similarity)
{
InitBlock(enclosingInstance);
this.reader = reader;
count = - 1;
maxDoc = reader.MaxDoc();
}
开发者ID:ArsenShnurkov,项目名称:beagle-1,代码行数:7,代码来源:MatchAllDocsQuery.cs
示例19: Bits
public override System.Collections.BitArray Bits(IndexReader reader)
{
if (cache == null)
{
cache = new SupportClass.WeakHashTable();
}
System.Object cached = null;
lock (cache.SyncRoot)
{
// check cache
cached = cache[reader];
}
if (cached != null)
{
if (cached is System.Collections.BitArray)
{
return (System.Collections.BitArray) cached;
}
else if (cached is DocIdBitSet)
return ((DocIdBitSet) cached).GetBitSet();
// It would be nice to handle the DocIdSet case, but that's not really possible
}
System.Collections.BitArray bits = filter.Bits(reader);
lock (cache.SyncRoot)
{
// update cache
cache[reader] = bits;
}
return bits;
}
开发者ID:Inzaghi2012,项目名称:teamlab.v7.5,代码行数:35,代码来源:CachingWrapperFilter.cs
示例20: FieldSortedHitQueue
/// <summary> Creates a hit queue sorted by the given list of fields.</summary>
/// <param name="reader"> Index to use.
/// </param>
/// <param name="fields">Fieldable names, in priority order (highest priority first). Cannot be <c>null</c> or empty.
/// </param>
/// <param name="size"> The number of hits to retain. Must be greater than zero.
/// </param>
/// <throws> IOException </throws>
public FieldSortedHitQueue(IndexReader reader, SortField[] fields, int size)
{
int n = fields.Length;
comparators = new ScoreDocComparator[n];
this.fields = new SortField[n];
for (int i = 0; i < n; ++i)
{
System.String fieldname = fields[i].GetField();
comparators[i] = GetCachedComparator(reader, fieldname, fields[i].GetType(), fields[i].GetParser(), fields[i].GetLocale(), fields[i].GetFactory());
// new SortField instances must only be created when auto-detection is in use
if (fields[i].GetType() == SortField.AUTO)
{
if (comparators[i].SortType() == SortField.STRING)
{
this.fields[i] = new SortField(fieldname, fields[i].GetLocale(), fields[i].GetReverse());
}
else
{
this.fields[i] = new SortField(fieldname, comparators[i].SortType(), fields[i].GetReverse());
}
}
else
{
System.Diagnostics.Debug.Assert(comparators [i].SortType() == fields [i].GetType());
this.fields[i] = fields[i];
}
}
Initialize(size);
}
开发者ID:sinsay,项目名称:SSE,代码行数:37,代码来源:FieldSortedHitQueue.cs
注:本文中的Lucene.Net.Index.IndexReader类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论