Search in sources :

Example 16 with PerfRunData

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);
}
Also used : Path(java.nio.file.Path) PerfRunData(org.apache.lucene.benchmark.byTask.PerfRunData)

Example 17 with PerfRunData

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;
}
Also used : Config(org.apache.lucene.benchmark.byTask.utils.Config) IndexWriterConfig(org.apache.lucene.index.IndexWriterConfig) PerfRunData(org.apache.lucene.benchmark.byTask.PerfRunData)

Example 18 with PerfRunData

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;
}
Also used : IndexWriter(org.apache.lucene.index.IndexWriter) DirectoryReader(org.apache.lucene.index.DirectoryReader) PerfRunData(org.apache.lucene.benchmark.byTask.PerfRunData)

Example 19 with PerfRunData

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;
}
Also used : PerfRunData(org.apache.lucene.benchmark.byTask.PerfRunData) DirectoryTaxonomyReader(org.apache.lucene.facet.taxonomy.directory.DirectoryTaxonomyReader)

Example 20 with PerfRunData

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')");
    }
}
Also used : 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