Methods Summary |
---|
public org.apache.lucene.search.Query | makeQuery()
return queries[nextQnum()];
|
public org.apache.lucene.search.Query | makeQuery(int size)
throw new Exception(this+".makeQuery(int size) is not supported!");
|
private synchronized int | nextQnum()
int res = qnum;
qnum = (qnum+1) % queries.length;
return res;
|
protected org.apache.lucene.search.Query[] | prepareQueries()Prepare the queries for this test.
Extending classes can overide this method for preparing different queries.
// analyzer (default is standard analyzer)
Analyzer anlzr= (Analyzer) Class.forName(config.get("analyzer",
"org.apache.lucene.analysis.StandardAnalyzer")).newInstance();
QueryParser qp = new QueryParser("body",anlzr);
ArrayList qq = new ArrayList();
Query q1 = new TermQuery(new Term("docid","doc2"));
qq.add(q1);
Query q2 = new TermQuery(new Term("body","simple"));
qq.add(q2);
BooleanQuery bq = new BooleanQuery();
bq.add(q1,Occur.MUST);
bq.add(q2,Occur.MUST);
qq.add(bq);
qq.add(qp.parse("synthetic body"));
qq.add(qp.parse("\"synthetic body\""));
qq.add(qp.parse("synthetic text"));
qq.add(qp.parse("\"synthetic text\""));
qq.add(qp.parse("\"synthetic text\"~3"));
qq.add(qp.parse("zoom*"));
qq.add(qp.parse("synth*"));
return (Query []) qq.toArray(new Query[0]);
|
public java.lang.String | printQueries()
String newline = System.getProperty("line.separator");
StringBuffer sb = new StringBuffer();
if (queries != null) {
for (int i = 0; i < queries.length; i++) {
sb.append(i+". "+Format.simpleName(queries[i].getClass())+" - "+queries[i].toString());
sb.append(newline);
}
}
return sb.toString();
|
public void | resetInputs()
qnum = 0;
|
public void | setConfig(org.apache.lucene.benchmark.byTask.utils.Config config)
this.config = config;
queries = prepareQueries();
|