use of org.apache.lucene.benchmark.byTask.utils.Config in project lucene-solr by apache.
the class DocMakerTest method createTestNormsDocument.
private Document createTestNormsDocument(boolean setNormsProp, boolean normsPropVal, boolean setBodyNormsProp, boolean bodyNormsVal) throws Exception {
Properties props = new Properties();
// Indexing configuration.
props.setProperty("analyzer", WhitespaceAnalyzer.class.getName());
props.setProperty("directory", "RAMDirectory");
if (setNormsProp) {
props.setProperty("doc.tokenized.norms", Boolean.toString(normsPropVal));
}
if (setBodyNormsProp) {
props.setProperty("doc.body.tokenized.norms", Boolean.toString(bodyNormsVal));
}
// Create PerfRunData
Config config = new Config(props);
DocMaker dm = new DocMaker();
dm.setConfig(config, new OneDocSource());
return dm.makeDocument();
}
use of org.apache.lucene.benchmark.byTask.utils.Config in project lucene-solr by apache.
the class TrecContentSourceTest method testTrecFeedDirAllTypes.
/**
* Open a trec content source over a directory with files of all trec path types and all
* supported formats - bzip, gzip, txt.
*/
public void testTrecFeedDirAllTypes() throws Exception {
Path dataDir = createTempDir("trecFeedAllTypes");
TestUtil.unzip(getDataInputStream("trecdocs.zip"), dataDir);
TrecContentSource tcs = new TrecContentSource();
Properties props = new Properties();
props.setProperty("print.props", "false");
props.setProperty("content.source.verbose", "false");
props.setProperty("content.source.excludeIteration", "true");
props.setProperty("docs.dir", dataDir.toRealPath().toString().replace('\\', '/'));
props.setProperty("trec.doc.parser", TrecParserByPath.class.getName());
props.setProperty("content.source.forever", "false");
tcs.setConfig(new Config(props));
tcs.resetInputs();
DocData dd = new DocData();
int n = 0;
boolean gotExpectedException = false;
HashSet<ParsePathType> unseenTypes = new HashSet<>(Arrays.asList(ParsePathType.values()));
try {
while (n < 100) {
// arbiterary limit to prevent looping forever in case of test failure
dd = tcs.getNextDocData(dd);
++n;
assertNotNull("doc data " + n + " should not be null!", dd);
unseenTypes.remove(tcs.currPathType);
switch(tcs.currPathType) {
case GOV2:
assertDocData(dd, "TEST-000", "TEST-000 title", "TEST-000 text", tcs.parseDate("Sun, 11 Jan 2009 08:00:00 GMT"));
break;
case FBIS:
assertDocData(dd, "TEST-001", "TEST-001 Title", "TEST-001 text", tcs.parseDate("1 January 1991"));
break;
case FR94:
// no title extraction in this source for now
assertDocData(dd, "TEST-002", null, "DEPARTMENT OF SOMETHING", tcs.parseDate("February 3, 1994"));
break;
case FT:
assertDocData(dd, "TEST-003", "Test-003 title", "Some pub text", tcs.parseDate("980424"));
break;
case LATIMES:
assertDocData(dd, "TEST-004", "Test-004 Title", "Some paragraph", tcs.parseDate("January 17, 1997, Sunday"));
break;
default:
assertTrue("Should never get here!", false);
}
}
} catch (NoMoreDataException e) {
gotExpectedException = true;
}
assertTrue("Should have gotten NoMoreDataException!", gotExpectedException);
assertEquals("Wrong number of documents created by source!", 5, n);
assertTrue("Did not see all types!", unseenTypes.isEmpty());
}
use of org.apache.lucene.benchmark.byTask.utils.Config in project lucene-solr by apache.
the class AddIndexesTaskTest method createPerfRunData.
private PerfRunData createPerfRunData() throws Exception {
Properties props = new Properties();
props.setProperty("writer.version", Version.LATEST.toString());
// don't print anything
props.setProperty("print.props", "false");
props.setProperty("directory", "RAMDirectory");
props.setProperty(AddIndexesTask.ADDINDEXES_INPUT_DIR, inputDir.toAbsolutePath().toString());
Config config = new Config(props);
return new PerfRunData(config);
}
use of org.apache.lucene.benchmark.byTask.utils.Config in project lucene-solr by apache.
the class PerfTaskTest method createPerfRunData.
private PerfRunData createPerfRunData(boolean setLogStep, int logStepVal, boolean setTaskLogStep, int taskLogStepVal) throws Exception {
Properties props = new Properties();
if (setLogStep) {
props.setProperty("log.step", Integer.toString(logStepVal));
}
if (setTaskLogStep) {
props.setProperty("log.step.MyPerf", Integer.toString(taskLogStepVal));
}
// no accidental FS dir.
props.setProperty("directory", "RAMDirectory");
Config config = new Config(props);
return new PerfRunData(config);
}
use of org.apache.lucene.benchmark.byTask.utils.Config in project lucene-solr by apache.
the class SearchWithSortTaskTest method testSetParams_docField.
public void testSetParams_docField() throws Exception {
SearchWithSortTask task = new SearchWithSortTask(new PerfRunData(new Config(new Properties())));
task.setParams("doc");
assertEquals(SortField.Type.DOC, task.getSort().getSort()[0].getType());
}
Aggregations