本文整理汇总了C#中Lucene.Net.Search.Similarity类的典型用法代码示例。如果您正苦于以下问题:C# Lucene.Net.Search.Similarity类的具体用法?C# Lucene.Net.Search.Similarity怎么用?C# Lucene.Net.Search.Similarity使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Lucene.Net.Search.Similarity类属于命名空间,在下文中一共展示了Lucene.Net.Search.Similarity类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SpanScorer
internal SpanScorer(Spans spans, Weight weight, Similarity similarity, byte[] norms) : base(similarity)
{
this.spans = spans;
this.norms = norms;
this.weight = weight;
this.value_Renamed = weight.GetValue();
}
示例2: DocumentWriter
/// <summary>This ctor used by test code only.
///
/// </summary>
/// <param name="directory">The directory to write the document information to
/// </param>
/// <param name="analyzer">The analyzer to use for the document
/// </param>
/// <param name="similarity">The Similarity function
/// </param>
/// <param name="maxFieldLength">The maximum number of tokens a field may have
/// </param>
public DocumentWriter(Directory directory, Analyzer analyzer, Similarity similarity, int maxFieldLength)
{
InitBlock();
this.directory = directory;
this.analyzer = analyzer;
this.similarity = similarity;
this.maxFieldLength = maxFieldLength;
}
示例3: SpanWeight
public SpanWeight(SpanQuery query, Searcher searcher)
{
this.similarity = query.GetSimilarity(searcher);
this.query = query;
this.terms = query.GetTerms();
idf = this.query.GetSimilarity(searcher).Idf(terms, searcher);
}
示例4: SpanWeight
public SpanWeight(SpanQuery query, Searcher searcher)
{
this.similarity = query.GetSimilarity(searcher);
this.query = query;
terms = new System.Collections.Hashtable();
query.ExtractTerms(terms);
System.Collections.ArrayList tmp = new System.Collections.ArrayList(terms.Values);
idf = this.query.GetSimilarity(searcher).Idf(tmp, searcher);
}
示例5: SpanScorer
protected internal SpanScorer(Spans spans, Weight weight, Similarity similarity, byte[] norms):base(similarity)
{
this.spans = spans;
this.norms = norms;
this.weight = weight;
this.value_Renamed = weight.GetValue();
if (this.spans.Next())
{
doc = - 1;
}
else
{
doc = NO_MORE_DOCS;
more = false;
}
}
示例6: PayloadNearSpanScorer
protected internal PayloadNearSpanScorer(PayloadNearQuery enclosingInstance, Lucene.Net.Search.Spans.Spans spans, Weight weight, Similarity similarity, byte[] norms)
: base(spans, weight, similarity, norms)
{
InitBlock(enclosingInstance);
this.spans = spans;
}
示例7: SetSimilarity
/// <summary>Expert: Set the Similarity implementation used by this IndexWriter.
///
/// </summary>
/// <seealso cref="Similarity.SetDefault(Similarity)">
/// </seealso>
public virtual void SetSimilarity(Similarity similarity)
{
EnsureOpen();
this.similarity = similarity;
docWriter.SetSimilarity(similarity);
}
示例8: DocumentsWriter
internal DocumentsWriter(Directory directory, IndexWriter writer)
{
this.directory = directory;
this.writer = writer;
this.similarity = writer.GetSimilarity();
flushedDocCount = writer.MaxDoc();
byteBlockAllocator = new ByteBlockAllocator(this);
waitQueue = new WaitQueue(this);
/*
This is the current indexing chain:
DocConsumer / DocConsumerPerThread
--> code: DocFieldProcessor / DocFieldProcessorPerThread
--> DocFieldConsumer / DocFieldConsumerPerThread / DocFieldConsumerPerField
--> code: DocFieldConsumers / DocFieldConsumersPerThread / DocFieldConsumersPerField
--> code: DocInverter / DocInverterPerThread / DocInverterPerField
--> InvertedDocConsumer / InvertedDocConsumerPerThread / InvertedDocConsumerPerField
--> code: TermsHash / TermsHashPerThread / TermsHashPerField
--> TermsHashConsumer / TermsHashConsumerPerThread / TermsHashConsumerPerField
--> code: FreqProxTermsWriter / FreqProxTermsWriterPerThread / FreqProxTermsWriterPerField
--> code: TermVectorsTermsWriter / TermVectorsTermsWriterPerThread / TermVectorsTermsWriterPerField
--> InvertedDocEndConsumer / InvertedDocConsumerPerThread / InvertedDocConsumerPerField
--> code: NormsWriter / NormsWriterPerThread / NormsWriterPerField
--> code: StoredFieldsWriter / StoredFieldsWriterPerThread / StoredFieldsWriterPerField
*/
// TODO FI: this should be something the user can pass in
// Build up indexing chain:
TermsHashConsumer termVectorsWriter = new TermVectorsTermsWriter(this);
TermsHashConsumer freqProxWriter = new FreqProxTermsWriter();
InvertedDocConsumer termsHash = new TermsHash(this, true, freqProxWriter,
new TermsHash(this, false, termVectorsWriter, null));
NormsWriter normsWriter = new NormsWriter();
DocInverter docInverter = new DocInverter(termsHash, normsWriter);
StoredFieldsWriter fieldsWriter = new StoredFieldsWriter(this);
DocFieldConsumers docFieldConsumers = new DocFieldConsumers(docInverter, fieldsWriter);
consumer = docFieldProcessor = new DocFieldProcessor(this, docFieldConsumers);
}
示例9: WriteDoc
/// <summary> Writes the document to the directory segment using the analyzer and the similarity score</summary>
/// <param name="">dir
/// </param>
/// <param name="">analyzer
/// </param>
/// <param name="">similarity
/// </param>
/// <param name="">segment
/// </param>
/// <param name="">doc
/// </param>
public static void WriteDoc(Directory dir, Analyzer analyzer, Similarity similarity, System.String segment, Document doc)
{
DocumentWriter writer = new DocumentWriter(dir, analyzer, similarity, 50);
try
{
writer.AddDocument(segment, doc);
}
catch (System.IO.IOException e)
{
System.Console.Error.WriteLine(e.StackTrace);
}
}
示例10: JustCompileSpanScorer
internal JustCompileSpanScorer(Spans spans, Weight weight, Similarity similarity, byte[] norms):base(spans, weight, similarity, norms)
{
}
示例11: SetUp
/// <summary> Sets up a RAMDirectory, and adds documents (using English.intToEnglish()) with two fields: field and multiField
/// and analyzes them using the PayloadAnalyzer
/// </summary>
/// <param name="similarity">The Similarity class to use in the Searcher
/// </param>
/// <param name="numDocs">The num docs to add
/// </param>
/// <returns> An IndexSearcher
/// </returns>
/// <throws> IOException </throws>
public virtual IndexSearcher SetUp(Similarity similarity, int numDocs)
{
RAMDirectory directory = new RAMDirectory();
PayloadAnalyzer analyzer = new PayloadAnalyzer(this);
IndexWriter writer = new IndexWriter(directory, analyzer, true);
writer.SetSimilarity(similarity);
//writer.infoStream = System.out;
for (int i = 0; i < numDocs; i++)
{
Document doc = new Document();
doc.Add(new Field(FIELD, English.IntToEnglish(i), Field.Store.YES, Field.Index.ANALYZED));
doc.Add(new Field(MULTI_FIELD, English.IntToEnglish(i) + " " + English.IntToEnglish(i), Field.Store.YES, Field.Index.ANALYZED));
doc.Add(new Field(NO_PAYLOAD_FIELD, English.IntToEnglish(i), Field.Store.YES, Field.Index.ANALYZED));
writer.AddDocument(doc);
}
//writer.optimize();
writer.Close();
IndexSearcher searcher = new IndexSearcher(directory);
searcher.SetSimilarity(similarity);
return searcher;
}
示例12: SetSimilarity
internal void SetSimilarity(Similarity similarity)
{
lock (this)
{
this.similarity = similarity;
for (int i = 0; i < threadStates.Length; i++)
threadStates[i].docState.similarity = similarity;
}
}
示例13: InitBlock
private void InitBlock(PayloadNearQuery enclosingInstance)
{
this.enclosingInstance = enclosingInstance;
similarity = GetSimilarity();
}
示例14: SetSimilarity
public void SetSimilarity(Lucene.Net.Search.Similarity similarity)
{
this.similarity = similarity;
}
示例15: MoreLikeThis
public MoreLikeThis(IndexReader ir, Lucene.Net.Search.Similarity sim)
{
this.ir = ir;
this.similarity = sim;
}