FileDocCategorySizeDatePackage
SimpleQueryMaker.javaAPI DocApache Lucene 2.2.02574Sat Jun 16 22:20:58 BST 2007org.apache.lucene.benchmark.byTask.feeds

SimpleQueryMaker

public class SimpleQueryMaker extends AbstractQueryMaker implements QueryMaker
A QueryMaker that makes queries for a collection created using {@link org.apache.lucene.benchmark.byTask.feeds.SimpleDocMaker}.

Fields Summary
Constructors Summary
Methods Summary
protected org.apache.lucene.search.Query[]prepareQueries()
Prepare the queries for this test. Extending classes can overide this method for preparing different queries.

return
prepared queries.
throws
Exception if canot prepare the queries.

    // analyzer (default is standard analyzer)
    Analyzer anlzr= (Analyzer) Class.forName(config.get("analyzer",
        "org.apache.lucene.analysis.standard.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]);