use of org.apache.lucene.benchmark.byTask.PerfRunData in project lucene-solr by apache.
the class WriteLineDocTaskTest method testEmptyBody.
public void testEmptyBody() throws Exception {
// WriteLineDocTask threw away documents w/ no BODY element, even if they
// had a TITLE element (LUCENE-1755). It should throw away documents if they
// don't have BODY nor TITLE
Path file = getWorkDir().resolve("one-line");
PerfRunData runData = createPerfRunData(file, false, NoBodyDocMaker.class.getName());
WriteLineDocTask wldt = new WriteLineDocTask(runData);
wldt.doLogic();
wldt.close();
doReadTest(file, Type.PLAIN, "title", "date", null);
}
use of org.apache.lucene.benchmark.byTask.PerfRunData in project lucene-solr by apache.
the class CreateIndexTask method doLogic.
@Override
public int doLogic() throws IOException {
PerfRunData runData = getRunData();
Config config = runData.getConfig();
runData.setIndexWriter(configureWriter(config, runData, OpenMode.CREATE, null));
return 1;
}
use of org.apache.lucene.benchmark.byTask.PerfRunData in project lucene-solr by apache.
the class NearRealtimeReaderTask method doLogic.
@Override
public int doLogic() throws Exception {
final PerfRunData runData = getRunData();
// Get initial reader
IndexWriter w = runData.getIndexWriter();
if (w == null) {
throw new RuntimeException("please open the writer before invoking NearRealtimeReader");
}
if (runData.getIndexReader() != null) {
throw new RuntimeException("please close the existing reader before invoking NearRealtimeReader");
}
long t = System.currentTimeMillis();
DirectoryReader r = DirectoryReader.open(w);
runData.setIndexReader(r);
// Transfer our reference to runData
r.decRef();
// TODO: gather basic metrics for reporting -- eg mean,
// stddev, min/max reopen latencies
// Parent sequence sets stopNow
reopenCount = 0;
while (!stopNow) {
long waitForMsec = (pauseMSec - (System.currentTimeMillis() - t));
if (waitForMsec > 0) {
Thread.sleep(waitForMsec);
//System.out.println("NRT wait: " + waitForMsec + " msec");
}
t = System.currentTimeMillis();
final DirectoryReader newReader = DirectoryReader.openIfChanged(r);
if (newReader != null) {
final int delay = (int) (System.currentTimeMillis() - t);
if (reopenTimes.length == reopenCount) {
reopenTimes = ArrayUtil.grow(reopenTimes, 1 + reopenCount);
}
reopenTimes[reopenCount++] = delay;
// TODO: somehow we need to enable warming, here
runData.setIndexReader(newReader);
// Transfer our reference to runData
newReader.decRef();
r = newReader;
}
}
stopNow = false;
return reopenCount;
}
use of org.apache.lucene.benchmark.byTask.PerfRunData in project lucene-solr by apache.
the class OpenTaxonomyReaderTask method doLogic.
@Override
public int doLogic() throws IOException {
PerfRunData runData = getRunData();
DirectoryTaxonomyReader taxoReader = new DirectoryTaxonomyReader(runData.getTaxonomyDir());
runData.setTaxonomyReader(taxoReader);
// We transfer reference to the run data
taxoReader.decRef();
return 1;
}
use of org.apache.lucene.benchmark.byTask.PerfRunData in project lucene-solr by apache.
the class SearchTravRetHighlightTask method setup.
@Override
public void setup() throws Exception {
super.setup();
//check to make sure either the doc is being stored
PerfRunData data = getRunData();
if (data.getConfig().get("doc.stored", false) == false) {
throw new Exception("doc.stored must be set to true");
}
maxDocCharsToAnalyze = data.getConfig().get("highlighter.maxDocCharsToAnalyze", Highlighter.DEFAULT_MAX_CHARS_TO_ANALYZE);
analyzer = data.getAnalyzer();
String type = this.type;
if (type == null) {
type = data.getConfig().get("highlighter", null);
}
switch(type) {
case "NONE":
hlImpl = new NoHLImpl();
break;
case "SH_A":
hlImpl = new StandardHLImpl(false);
break;
case "SH_V":
hlImpl = new StandardHLImpl(true);
break;
case "FVH_V":
hlImpl = new FastVectorHLImpl();
break;
case "UH":
hlImpl = new UnifiedHLImpl(null);
break;
case "UH_A":
hlImpl = new UnifiedHLImpl(UnifiedHighlighter.OffsetSource.ANALYSIS);
break;
case "UH_V":
hlImpl = new UnifiedHLImpl(UnifiedHighlighter.OffsetSource.TERM_VECTORS);
break;
case "UH_P":
hlImpl = new UnifiedHLImpl(UnifiedHighlighter.OffsetSource.POSTINGS);
break;
case "UH_PV":
hlImpl = new UnifiedHLImpl(UnifiedHighlighter.OffsetSource.POSTINGS_WITH_TERM_VECTORS);
break;
default:
throw new Exception("unrecognized highlighter type: " + type + " (try 'UH')");
}
}
Aggregations