当前位置: 首页>>代码示例>>C#>>正文


C# Term.ToString方法代码示例

本文整理汇总了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();
     }
 }
开发者ID:argsv,项目名称:NuGetGallery,代码行数:21,代码来源:LuceneIndexingService.cs

示例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();
                }
            }
        }
开发者ID:henrycomein,项目名称:NuGetGallery,代码行数:37,代码来源:LuceneIndexingService.cs

示例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());
 }
开发者ID:WakeflyCBass,项目名称:lucenenet,代码行数:5,代码来源:TestBinaryTerms.cs

示例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();
            }
        }
开发者ID:JetBrains,项目名称:ReSharperGallery,代码行数:20,代码来源:LuceneIndexingService.cs


注:本文中的Lucene.Net.Index.Term.ToString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。