FileDocCategorySizeDatePackage
QueryData.javaAPI DocApache Lucene 2.1.02517Wed Feb 14 10:46:16 GMT 2007org.apache.lucene.benchmark.stats

QueryData

public class QueryData extends Object
This class holds parameters for a query benchmark.
author
Andrzej Bialecki <ab@getopt.org>

Fields Summary
public String
id
Benchmark id
public Query
q
Lucene query
public boolean
reopen
If true, re-open index reader before benchmark.
public boolean
warmup
If true, warm-up the index reader before searching by sequentially retrieving all documents from index.
public boolean
retrieve
If true, actually retrieve documents returned in Hits.
Constructors Summary
Methods Summary
public static org.apache.lucene.benchmark.stats.QueryData[]getAll(org.apache.lucene.search.Query[] queries)
Prepare a list of benchmark data, using all possible combinations of benchmark parameters.

param
queries source Lucene queries
return
The QueryData

    Vector vqd = new Vector();
    for (int i = 0; i < queries.length; i++) {
      for (int r = 1; r >= 0; r--) {
        for (int w = 1; w >= 0; w--) {
          for (int t = 0; t < 2; t++) {
            QueryData qd = new QueryData();
            qd.id="qd-" + i + r + w + t;
            qd.reopen = Constants.BOOLEANS[r].booleanValue();
            qd.warmup = Constants.BOOLEANS[w].booleanValue();
            qd.retrieve = Constants.BOOLEANS[t].booleanValue();
            qd.q = queries[i];
            vqd.add(qd);
          }
        }
      }
    }
    return (QueryData[])vqd.toArray(new QueryData[0]);
  
public static java.lang.StringgetLabels()
Short legend for interpreting toString() output.

    return "# Query data: R-reopen, W-warmup, T-retrieve, N-no";
  
public java.lang.StringtoString()

    return id + " " + (reopen ? "R" : "NR") + " " + (warmup ? "W" : "NW") +
      " " + (retrieve ? "T" : "NT") + " [" + q.toString() + "]";