/*
 * TEST.java
 *
 * Created on 2002. április 7., 0:18
 */

package iac;
import org.apache.lucene.search.*;
import org.apache.lucene.index.*;
/**
 *
 * @author  Peter Halácsy
 * @version
 */
public class TEST {

    /** Creates new TEST */
    public TEST() {
    }

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) throws Exception {
		// keeping a searcher instance alive causes that IAC won't
		// close Searcher --> more faster
        Searcher s = IndexAccessControl.getInstance("c:\\temp\\index\\messages").getSearcher();
        long start = System.currentTimeMillis();
        IndexAccessControl iac = IndexAccessControl.getInstance("c:\\temp\\index\\messages");
        for(int i = 0; i< 100; i++){
           Searcher searcher = iac.getSearcher();
           // Searcher searcher = new IndexSearcher("c:\\temp\\index\\messages");
           Hits hits = searcher.search(new TermQuery(new Term("text", "google")));
           System.out.println("" + hits.length());
            searcher.close();
        }

        System.out.println((float)(System.currentTimeMillis() - start) / (float) 100);
        s.close();

    }

}
