本文整理汇总了C#中Lucene.Net.Index.Term.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# Term.ToString方法的具体用法?C# Term.ToString怎么用?C# Term.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Lucene.Net.Index.Term
的用法示例。
在下文中一共展示了Term.ToString方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: UpdatePackage
public void UpdatePackage(Package package)
{
// Just update the provided package
using (Trace.Activity(String.Format(CultureInfo.CurrentCulture, "Updating Lucene Index for: {0} {1} [PackageKey:{2}]", package.PackageRegistration.Id, package.Version, package.Key)))
{
EnsureIndexWriter(creatingIndex: false);
var indexEntity = new PackageIndexEntity(package);
var updateTerm = new Term("PackageRegistrationKey", package.PackageRegistrationKey.ToString(CultureInfo.InvariantCulture));
if (package.Listed)
{
Trace.Information(String.Format(CultureInfo.CurrentCulture, "Updating Document: {0}", updateTerm.ToString()));
_indexWriter.UpdateDocument(updateTerm, indexEntity.ToDocument());
}
else
{
Trace.Information(String.Format(CultureInfo.CurrentCulture, "Deleting Document: {0}", updateTerm.ToString()));
_indexWriter.DeleteDocuments(updateTerm);
}
_indexWriter.Commit();
}
}
示例2: UpdatePackage
public void UpdatePackage(Package package)
{
if (_getShouldAutoUpdate())
{
var packageRegistrationKey = package.PackageRegistrationKey;
var updateTerm = new Term("PackageRegistrationKey", packageRegistrationKey.ToString(CultureInfo.InvariantCulture));
if (!package.IsLatest || !package.IsLatestStable)
{
// Someone passed us in a version which was e.g. just unlisted? Or just not the latest version which is what we want to index. Doesn't really matter. We'll find one to index.
package = _packageRepository.GetAll()
.Where(p => (p.IsLatest || p.IsLatestStable) && p.PackageRegistrationKey == packageRegistrationKey)
.Include(p => p.PackageRegistration)
.Include(p => p.PackageRegistration.Owners)
.Include(p => p.SupportedFrameworks)
.FirstOrDefault();
}
// Just update the provided package
using (Trace.Activity(String.Format(CultureInfo.CurrentCulture, "Updating Document: {0}", updateTerm.ToString())))
{
EnsureIndexWriter(creatingIndex: false);
if (package != null)
{
var indexEntity = new PackageIndexEntity(package);
Trace.Information(String.Format(CultureInfo.CurrentCulture, "Updating Lucene Index for: {0} {1} [PackageKey:{2}]", package.PackageRegistration.Id, package.Version, package.Key));
_indexWriter.UpdateDocument(updateTerm, indexEntity.ToDocument());
}
else
{
Trace.Information(String.Format(CultureInfo.CurrentCulture, "Deleting Document: {0}", updateTerm.ToString()));
_indexWriter.DeleteDocuments(updateTerm);
}
_indexWriter.Commit();
}
}
}
示例3: TestToString
public virtual void TestToString()
{
Term term = new Term("foo", new BytesRef(new[] { unchecked((byte)0xff), unchecked((byte)0xfe) }));
Assert.AreEqual("foo:[ff fe]", term.ToString());
}
示例4: UpdatePackage
public void UpdatePackage(Package package)
{
var packageRegistrationKey = package.PackageRegistrationKey;
// We can't just update that one document. Someone might have unlisted, and therefore changed the IsLatest(Stable)
// flags. Update the whole registration, and all curated feeds
var packagesForIndexing = GetPackages(lastIndexTime: null, package: package);
packagesForIndexing.AddRange(GetCuratedPackages(lastIndexTime: null, package: package));
// Just update the provided package
var updateTerm = new Term("PackageRegistrationKey", packageRegistrationKey.ToString(CultureInfo.InvariantCulture));
using (Trace.Activity(String.Format(CultureInfo.CurrentCulture, "Updating Document: {0}", updateTerm.ToString())))
{
EnsureIndexWriter(creatingIndex: false);
// This will delete existing documents
AddPackages(packagesForIndexing, false);
_indexWriter.Commit();
}
}