FileDocCategorySizeDatePackage
BooleanQueryTst.javaAPI DocApache Lucene 2.2.03469Sat Jun 16 22:20:44 BST 2007org.apache.lucene.queryParser.surround.query

BooleanQueryTst

public class BooleanQueryTst extends Object
Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Fields Summary
String
queryText
final int[]
expectedDocNrs
SingleFieldTestDb
dBase
String
fieldName
TestCase
testCase
BasicQueryFactory
qf
boolean
verbose
Constructors Summary
public BooleanQueryTst(String queryText, int[] expectedDocNrs, SingleFieldTestDb dBase, String fieldName, TestCase testCase, BasicQueryFactory qf)


   
       
       
       
       
       
        
    this.queryText = queryText;
    this.expectedDocNrs = expectedDocNrs;
    this.dBase = dBase;
    this.fieldName = fieldName;
    this.testCase = testCase;
    this.qf = qf;
  
Methods Summary
public voiddoTest()


    if (verbose) {    
        System.out.println("");
        System.out.println("Query: " + queryText);
    }
    
    SrndQuery lq = QueryParser.parse(queryText);
    
    /* if (verbose) System.out.println("Srnd: " + lq.toString()); */
    
    Query query = lq.makeLuceneQueryField(fieldName, qf);
    /* if (verbose) System.out.println("Lucene: " + query.toString()); */

    TestCollector tc = new TestCollector();
    Searcher searcher = new IndexSearcher(dBase.getDb());
    try {
      searcher.search(query, tc);
    } finally {
      searcher.close();
    }
    tc.checkNrHits();
  
public voidsetVerbose(boolean verbose)

this.verbose = verbose;