Search in sources :

Example 31 with PerfRunData

use of org.apache.lucene.benchmark.byTask.PerfRunData in project lucene-solr by apache.

the class CommitIndexTaskTest 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");
    Config config = new Config(props);
    return new PerfRunData(config);
}
Also used : Config(org.apache.lucene.benchmark.byTask.utils.Config) PerfRunData(org.apache.lucene.benchmark.byTask.PerfRunData) Properties(java.util.Properties)

Example 32 with PerfRunData

use of org.apache.lucene.benchmark.byTask.PerfRunData in project lucene-solr by apache.

the class WriteEnwikiLineDocTaskTest method createPerfRunData.

private PerfRunData createPerfRunData(Path file, String docMakerName) throws Exception {
    Properties props = new Properties();
    props.setProperty("doc.maker", docMakerName);
    props.setProperty("line.file.out", file.toAbsolutePath().toString());
    // no accidental FS dir.
    props.setProperty("directory", "RAMDirectory");
    Config config = new Config(props);
    return new PerfRunData(config);
}
Also used : Config(org.apache.lucene.benchmark.byTask.utils.Config) PerfRunData(org.apache.lucene.benchmark.byTask.PerfRunData) Properties(java.util.Properties)

Example 33 with PerfRunData

use of org.apache.lucene.benchmark.byTask.PerfRunData in project lucene-solr by apache.

the class WriteEnwikiLineDocTaskTest method testCategoryLines.

public void testCategoryLines() throws Exception {
    // WriteLineDocTask replaced only \t characters w/ a space, since that's its
    // separator char. However, it didn't replace newline characters, which
    // resulted in errors in LineDocSource.
    Path file = getWorkDir().resolve("two-lines-each.txt");
    PerfRunData runData = createPerfRunData(file, WriteLineCategoryDocMaker.class.getName());
    WriteLineDocTask wldt = new WriteEnwikiLineDocTask(runData);
    for (int i = 0; i < 4; i++) {
        // four times so that each file should have 2 lines. 
        wldt.doLogic();
    }
    wldt.close();
    doReadTest(file, "title text", "date text", "body text");
}
Also used : Path(java.nio.file.Path) PerfRunData(org.apache.lucene.benchmark.byTask.PerfRunData)

Example 34 with PerfRunData

use of org.apache.lucene.benchmark.byTask.PerfRunData in project lucene-solr by apache.

the class WriteLineDocTaskTest method testEmptyTitle.

public void testEmptyTitle() throws Exception {
    Path file = getWorkDir().resolve("one-line");
    PerfRunData runData = createPerfRunData(file, false, NoTitleDocMaker.class.getName());
    WriteLineDocTask wldt = new WriteLineDocTask(runData);
    wldt.doLogic();
    wldt.close();
    doReadTest(file, Type.PLAIN, "", "date", "body");
}
Also used : Path(java.nio.file.Path) PerfRunData(org.apache.lucene.benchmark.byTask.PerfRunData)

Example 35 with PerfRunData

use of org.apache.lucene.benchmark.byTask.PerfRunData in project lucene-solr by apache.

the class WriteLineDocTaskTest method testLegalJustDate.

public void testLegalJustDate() throws Exception {
    Path file = getWorkDir().resolve("one-line");
    PerfRunData runData = createPerfRunData(file, false, LegalJustDateDocMaker.class.getName());
    WriteLineDocTask wldt = new WriteLineDocTask(runData);
    wldt.doLogic();
    wldt.close();
    try (BufferedReader br = Files.newBufferedReader(file, StandardCharsets.UTF_8)) {
        String line = br.readLine();
        assertHeaderLine(line);
        line = br.readLine();
        assertNotNull(line);
    }
}
Also used : Path(java.nio.file.Path) BufferedReader(java.io.BufferedReader) PerfRunData(org.apache.lucene.benchmark.byTask.PerfRunData)

Aggregations

PerfRunData (org.apache.lucene.benchmark.byTask.PerfRunData)40 Config (org.apache.lucene.benchmark.byTask.utils.Config)13 Path (java.nio.file.Path)12 Properties (java.util.Properties)10 BufferedReader (java.io.BufferedReader)4 AddDocTask (org.apache.lucene.benchmark.byTask.tasks.AddDocTask)3 CloseIndexTask (org.apache.lucene.benchmark.byTask.tasks.CloseIndexTask)3 CreateIndexTask (org.apache.lucene.benchmark.byTask.tasks.CreateIndexTask)3 TaskSequence (org.apache.lucene.benchmark.byTask.tasks.TaskSequence)3 IndexWriterConfig (org.apache.lucene.index.IndexWriterConfig)3 WhitespaceAnalyzer (org.apache.lucene.analysis.core.WhitespaceAnalyzer)2 DirectoryTaxonomyWriter (org.apache.lucene.facet.taxonomy.directory.DirectoryTaxonomyWriter)2 IndexReader (org.apache.lucene.index.IndexReader)2 IndexWriter (org.apache.lucene.index.IndexWriter)2 Term (org.apache.lucene.index.Term)2 IndexSearcher (org.apache.lucene.search.IndexSearcher)2 TermQuery (org.apache.lucene.search.TermQuery)2 TopDocs (org.apache.lucene.search.TopDocs)2 ByteArrayOutputStream (java.io.ByteArrayOutputStream)1 PrintStream (java.io.PrintStream)1