FileDocCategorySizeDatePackage
TestSimpleExplanations.javaAPI DocApache Lucene 2.2.09677Sat Jun 16 22:20:28 BST 2007org.apache.lucene.search

TestSimpleExplanations

public class TestSimpleExplanations extends TestExplanations
TestExplanations subclass focusing on basic query types

Fields Summary
Constructors Summary
Methods Summary
public voidtestBQ1()

    qtest("+w1 +w2", new int[] { 0,1,2,3 });
  
public voidtestBQ10()

    qtest("+w1 +(qq (-xx w2) -(+w3 +w4))", new int[] { 1 });
  
public voidtestBQ11()

    qtest("w1 w2^1000.0", new int[] { 0,1,2,3 });
  
public voidtestBQ14()

    BooleanQuery q = new BooleanQuery(true);
    q.add(qp.parse("QQQQQ"), BooleanClause.Occur.SHOULD);
    q.add(qp.parse("w1"), BooleanClause.Occur.SHOULD);
    qtest(q, new int[] { 0,1,2,3 });
  
public voidtestBQ15()

    BooleanQuery q = new BooleanQuery(true);
    q.add(qp.parse("QQQQQ"), BooleanClause.Occur.MUST_NOT);
    q.add(qp.parse("w1"), BooleanClause.Occur.SHOULD);
    qtest(q, new int[] { 0,1,2,3 });
  
public voidtestBQ16()

    BooleanQuery q = new BooleanQuery(true);
    q.add(qp.parse("QQQQQ"), BooleanClause.Occur.SHOULD);
    q.add(qp.parse("w1 -xx"), BooleanClause.Occur.SHOULD);
    qtest(q, new int[] { 0,1 });
  
public voidtestBQ17()

    BooleanQuery q = new BooleanQuery(true);
    q.add(qp.parse("w2"), BooleanClause.Occur.SHOULD);
    q.add(qp.parse("w1 -xx"), BooleanClause.Occur.SHOULD);
    qtest(q, new int[] { 0,1,2,3 });
  
public voidtestBQ19()

    qtest("-yy w3", new int[] { 0,1 });
  
public voidtestBQ2()

    qtest("+yy +w3", new int[] { 2,3 });
  
public voidtestBQ20()

    BooleanQuery q = new BooleanQuery();
    q.setMinimumNumberShouldMatch(2);
    q.add(qp.parse("QQQQQ"), BooleanClause.Occur.SHOULD);
    q.add(qp.parse("yy"), BooleanClause.Occur.SHOULD);
    q.add(qp.parse("zz"), BooleanClause.Occur.SHOULD);
    q.add(qp.parse("w5"), BooleanClause.Occur.SHOULD);
    q.add(qp.parse("w4"), BooleanClause.Occur.SHOULD);
    
    qtest(q, new int[] { 0,3 });
    
  
public voidtestBQ3()

    qtest("yy +w3", new int[] { 0,1,2,3 });
  
public voidtestBQ4()

    qtest("w1 (-xx w2)", new int[] { 0,1,2,3 });
  
public voidtestBQ5()

    qtest("w1 (+qq w2)", new int[] { 0,1,2,3 });
  
public voidtestBQ6()

    qtest("w1 -(-qq w5)", new int[] { 1,2,3 });
  
public voidtestBQ7()

    qtest("+w1 +(qq (xx -w2) (+w3 +w4))", new int[] { 0 });
  
public voidtestBQ8()

    qtest("+w1 (qq (xx -w2) (+w3 +w4))", new int[] { 0,1,2,3 });
  
public voidtestBQ9()

    qtest("+w1 (qq (-xx w2) -(+w3 +w4))", new int[] { 0,1,2,3 });
  
public voidtestCSQ1()

    Query q = new ConstantScoreQuery(new ItemizedFilter(new int[] {0,1,2,3}));
    qtest(q, new int[] {0,1,2,3});
  
public voidtestCSQ2()

    Query q = new ConstantScoreQuery(new ItemizedFilter(new int[] {1,3}));
    qtest(q, new int[] {1,3});
  
public voidtestCSQ3()

    Query q = new ConstantScoreQuery(new ItemizedFilter(new int[] {0,2}));
    q.setBoost(1000);
    qtest(q, new int[] {0,2});
  
public voidtestDMQ1()

    DisjunctionMaxQuery q = new DisjunctionMaxQuery(0.0f);
    q.add(qp.parse("w1"));
    q.add(qp.parse("w5"));
    qtest(q, new int[] { 0,1,2,3 });
  
public voidtestDMQ2()

    DisjunctionMaxQuery q = new DisjunctionMaxQuery(0.5f);
    q.add(qp.parse("w1"));
    q.add(qp.parse("w5"));
    qtest(q, new int[] { 0,1,2,3 });
  
public voidtestDMQ3()

    DisjunctionMaxQuery q = new DisjunctionMaxQuery(0.5f);
    q.add(qp.parse("QQ"));
    q.add(qp.parse("w5"));
    qtest(q, new int[] { 0 });
  
public voidtestDMQ4()

    DisjunctionMaxQuery q = new DisjunctionMaxQuery(0.5f);
    q.add(qp.parse("QQ"));
    q.add(qp.parse("xx"));
    qtest(q, new int[] { 2,3 });
  
public voidtestDMQ5()

    DisjunctionMaxQuery q = new DisjunctionMaxQuery(0.5f);
    q.add(qp.parse("yy -QQ"));
    q.add(qp.parse("xx"));
    qtest(q, new int[] { 2,3 });
  
public voidtestDMQ6()

    DisjunctionMaxQuery q = new DisjunctionMaxQuery(0.5f);
    q.add(qp.parse("-yy w3"));
    q.add(qp.parse("xx"));
    qtest(q, new int[] { 0,1,2,3 });
  
public voidtestDMQ7()

    DisjunctionMaxQuery q = new DisjunctionMaxQuery(0.5f);
    q.add(qp.parse("-yy w3"));
    q.add(qp.parse("w2"));
    qtest(q, new int[] { 0,1,2,3 });
  
public voidtestDMQ8()

    DisjunctionMaxQuery q = new DisjunctionMaxQuery(0.5f);
    q.add(qp.parse("yy w5^100"));
    q.add(qp.parse("xx^100000"));
    qtest(q, new int[] { 0,2,3 });
  
public voidtestDMQ9()

    DisjunctionMaxQuery q = new DisjunctionMaxQuery(0.5f);
    q.add(qp.parse("yy w5^100"));
    q.add(qp.parse("xx^0"));
    qtest(q, new int[] { 0,2,3 });
  
public voidtestFQ1()

    qtest(new FilteredQuery(qp.parse("w1"),
                            new ItemizedFilter(new int[] {0,1,2,3})),
          new int[] {0,1,2,3});
  
public voidtestFQ2()

    qtest(new FilteredQuery(qp.parse("w1"),
                            new ItemizedFilter(new int[] {0,2,3})),
          new int[] {0,2,3});
  
public voidtestFQ3()

    qtest(new FilteredQuery(qp.parse("xx"),
                            new ItemizedFilter(new int[] {1,3})),
          new int[] {3});
  
public voidtestFQ4()

    qtest(new FilteredQuery(qp.parse("xx^1000"),
                            new ItemizedFilter(new int[] {1,3})),
          new int[] {3});
  
public voidtestFQ6()

    Query q = new FilteredQuery(qp.parse("xx"),
                                new ItemizedFilter(new int[] {1,3}));
    q.setBoost(1000);
    qtest(q, new int[] {3});
  
public voidtestMA1()

    qtest(new MatchAllDocsQuery(), new int[] { 0,1,2,3 });
  
public voidtestMA2()

    Query q=new MatchAllDocsQuery();
    q.setBoost(1000);
    qtest(q, new int[] { 0,1,2,3 });
  
public voidtestMPQ1()

    MultiPhraseQuery q = new MultiPhraseQuery();
    q.add(ta(new String[] {"w1"}));
    q.add(ta(new String[] {"w2","w3", "xx"}));
    qtest(q, new int[] { 0,1,2,3 });
  
public voidtestMPQ2()

    MultiPhraseQuery q = new MultiPhraseQuery();
    q.add(ta(new String[] {"w1"}));
    q.add(ta(new String[] {"w2","w3"}));
    qtest(q, new int[] { 0,1,3 });
  
public voidtestMPQ3()

    MultiPhraseQuery q = new MultiPhraseQuery();
    q.add(ta(new String[] {"w1","xx"}));
    q.add(ta(new String[] {"w2","w3"}));
    qtest(q, new int[] { 0,1,2,3 });
  
public voidtestMPQ4()

    MultiPhraseQuery q = new MultiPhraseQuery();
    q.add(ta(new String[] {"w1"}));
    q.add(ta(new String[] {"w2"}));
    qtest(q, new int[] { 0 });
  
public voidtestMPQ5()

    MultiPhraseQuery q = new MultiPhraseQuery();
    q.add(ta(new String[] {"w1"}));
    q.add(ta(new String[] {"w2"}));
    q.setSlop(1);
    qtest(q, new int[] { 0,1,2 });
  
public voidtestMPQ6()

    MultiPhraseQuery q = new MultiPhraseQuery();
    q.add(ta(new String[] {"w1","w3"}));
    q.add(ta(new String[] {"w2"}));
    q.setSlop(1);
    qtest(q, new int[] { 0,1,2,3 });
  
public voidtestP1()

    qtest("\"w1 w2\"", new int[] { 0 });
  
public voidtestP2()

    qtest("\"w1 w3\"", new int[] { 1,3 });
  
public voidtestP3()

    qtest("\"w1 w2\"~1", new int[] { 0,1,2 });
  
public voidtestP4()

    qtest("\"w2 w3\"~1", new int[] { 0,1,2,3 });
  
public voidtestP5()

    qtest("\"w3 w2\"~1", new int[] { 1,3 });
  
public voidtestP6()

    qtest("\"w3 w2\"~2", new int[] { 0,1,3 });
  
public voidtestP7()

    qtest("\"w3 w2\"~3", new int[] { 0,1,2,3 });
  
public voidtestT1()

    qtest("w1", new int[] { 0,1,2,3 });
  
public voidtestT2()

    qtest("w1^1000", new int[] { 0,1,2,3 });