blob: 0e2f37f3a9467c3d42c22a4d1586c022f0632e40 [file] [log] [blame]
using Lucene.Net.Index;
using Lucene.Net.Store;
using Console = Lucene.Net.Util.SystemConsole;
namespace Lucene.Net.Benchmarks.ByTask.Tasks
{
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/// <summary>
/// Opens a reader and prints basic statistics.
/// </summary>
public class PrintReaderTask : PerfTask
{
private string userData = null;
public PrintReaderTask(PerfRunData runData)
: base(runData)
{
}
public override void SetParams(string @params)
{
base.SetParams(@params);
userData = @params;
}
public override bool SupportsParams => true;
public override int DoLogic()
{
Directory dir = RunData.Directory;
IndexReader r; // LUCENENET: IDE0059: Remove unnecessary value assignment
if (userData == null)
r = DirectoryReader.Open(dir);
else
r = DirectoryReader.Open(OpenReaderTask.FindIndexCommit(dir, userData));
Console.WriteLine("--> numDocs:" + r.NumDocs + " dels:" + r.NumDeletedDocs);
r.Dispose();
return 1;
}
}
}