本文整理汇总了C#中Lucene.Net.Documents.Field.SetBoost方法的典型用法代码示例。如果您正苦于以下问题:C# Lucene.Net.Documents.Field.SetBoost方法的具体用法?C# Lucene.Net.Documents.Field.SetBoost怎么用?C# Lucene.Net.Documents.Field.SetBoost使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Lucene.Net.Documents.Field
的用法示例。
在下文中一共展示了Lucene.Net.Documents.Field.SetBoost方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: NewDoc
// create the next document
private Document NewDoc()
{
Document d = new Document();
float boost = NextNorm();
for (int i = 0; i < 10; i++)
{
Field f = new Field("f" + i, "v" + i, Field.Store.NO, Field.Index.NOT_ANALYZED);
f.SetBoost(boost);
d.Add(f);
}
return d;
}
示例2: SetUp
public override void SetUp()
{
base.SetUp();
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 < 1000; i++)
{
Document doc = new Document();
Field noPayloadField = new Field("noPayLoad", English.IntToEnglish(i), Field.Store.YES, Field.Index.TOKENIZED);
noPayloadField.SetBoost(0);
doc.Add(noPayloadField);
doc.Add(new Field("field", English.IntToEnglish(i), Field.Store.YES, Field.Index.TOKENIZED));
doc.Add(new Field("multiField", English.IntToEnglish(i) + " " + English.IntToEnglish(i), Field.Store.YES, Field.Index.TOKENIZED));
writer.AddDocument(doc);
}
writer.Optimize();
writer.Close();
searcher = new IndexSearcher(directory);
searcher.SetSimilarity(similarity);
}
示例3: AddDoc
private void AddDoc(System.String text, IndexWriter iw, float boost)
{
Document doc = new Document();
Field f = new Field("key", text, Field.Store.YES, Field.Index.ANALYZED);
f.SetBoost(boost);
doc.Add(f);
iw.AddDocument(doc);
}
示例4: NewDoc
// create the next document
private Lucene.Net.Documents.Document NewDoc()
{
Lucene.Net.Documents.Document d = new Lucene.Net.Documents.Document();
float boost = NextNorm();
for (int i = 0; i < 10; i++)
{
Field f = new Field("f" + i, "v" + i, Lucene.Net.Documents.Field.Store.NO, Lucene.Net.Documents.Field.Index.UN_TOKENIZED);
f.SetBoost(boost);
d.Add(f);
}
return d;
}