DocFreq() public method

public DocFreq ( Lucene.Net.Index.Term t ) : int
t Lucene.Net.Index.Term
return int
Beispiel #1
0
 public override void Run()
 {
     try
     {
         Document        doc = new Document();
         DirectoryReader r   = DirectoryReader.Open(Dir);
         Field           f   = NewStringField("f", "", Field.Store.NO);
         doc.Add(f);
         int count = 0;
         do
         {
             if (Failed.Get())
             {
                 break;
             }
             for (int j = 0; j < 10; j++)
             {
                 string s = FinalI + "_" + Convert.ToString(count++);
                 f.SetStringValue(s);
                 w.AddDocument(doc);
                 w.Commit();
                 DirectoryReader r2 = DirectoryReader.OpenIfChanged(r);
                 Assert.IsNotNull(r2);
                 Assert.IsTrue(!r2.Equals(r));
                 r.Dispose();
                 r = r2;
                 Assert.AreEqual(1, r.DocFreq(new Term("f", s)), "term=f:" + s + "; r=" + r);
             }
         } while (Environment.TickCount < EndTime);
         r.Dispose();
     }
     catch (Exception t)
     {
         Failed.Set(true);
         throw new Exception(t.Message, t);
     }
 }
Beispiel #2
0
 public override void Run()
 {
     try
     {
         Document        doc = new Document();
         DirectoryReader r   = DirectoryReader.Open(dir);
         Field           f   = newStringField("f", "", Field.Store.NO);
         doc.Add(f);
         int count = 0;
         do
         {
             if (failed)
             {
                 break;
             }
             for (int j = 0; j < 10; j++)
             {
                 string s = finalI + "_" + Convert.ToString(count++);
                 f.SetStringValue(s);
                 w.AddDocument(doc);
                 w.Commit();
                 DirectoryReader r2 = DirectoryReader.OpenIfChanged(r);
                 Assert.IsNotNull(r2);
                 Assert.IsTrue(!r2.Equals(r));
                 r.Dispose();
                 r = r2;
                 Assert.AreEqual(1, r.DocFreq(new Term("f", s)), "term=f:" + s + "; r=" + r);
             }
         } while ((J2N.Time.NanoTime() / J2N.Time.MillisecondsPerNanosecond) < endTime); // LUCENENET: Use NanoTime() rather than CurrentTimeMilliseconds() for more accurate/reliable results
         r.Dispose();
     }
     catch (Exception t) when(t.IsThrowable())
     {
         failed.Value = (true);
         throw RuntimeException.Create(t);
     }
 }