Index: conf/matcher-vs-bitset.alg =================================================================== --- conf/matcher-vs-bitset.alg (revision 0) +++ conf/matcher-vs-bitset.alg (revision 0) @@ -0,0 +1,74 @@ +#/** +# * 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. +# */ +# ------------------------------------------------------------------------------------- +# multi val params are iterated by NewRound's, added to reports, start with column name. + +merge.factor=10 +max.buffered=100 +compound=true + +analyzer=org.apache.lucene.analysis.standard.StandardAnalyzer +directory=FSDirectory + +doc.stored=true +doc.tokenized=true +doc.term.vector=false +doc.add.log.step=500 + +docs.dir=reuters-out +doc.maker.forever=false + +doc.maker=org.apache.lucene.benchmark.byTask.feeds.ReutersDocMaker + +query.maker=org.apache.lucene.benchmark.byTask.feeds.ReutersQueryMaker + +# task at this depth or less would print when they start +task.max.depth.log=2 + +log.queries=true +# ------------------------------------------------------------------------------------- + + +{ "Populate" + ResetSystemErase + CreateIndex + { AddDoc > : * + Optimize + CloseIndex +> + +{ "Rounds" + + OpenReader + { "SrchMtchSamRdr" Match > : 5000 + CloseReader + + OpenReader + { "SrchBitsSamRdr" Search > : 5000 + CloseReader + + { "SrchMtchNewRdr" Match > : 500 + + { "SrchBitsNewRdr" Search > : 500 + + NewRound + +} : 10 + +RepSumByPrefRound Srch + +RepSumByPref Srch Property changes on: conf/matcher-vs-bitset.alg ___________________________________________________________________ Name: svn:executable + * Index: src/java/org/apache/lucene/benchmark/byTask/tasks/ReadMatchTask.java =================================================================== --- src/java/org/apache/lucene/benchmark/byTask/tasks/ReadMatchTask.java (revision 0) +++ src/java/org/apache/lucene/benchmark/byTask/tasks/ReadMatchTask.java (revision 0) @@ -0,0 +1,101 @@ +package org.apache.lucene.benchmark.byTask.tasks; + +/** + * 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. + */ + +import org.apache.lucene.benchmark.byTask.PerfRunData; +import org.apache.lucene.benchmark.byTask.feeds.QueryMaker; +import org.apache.lucene.document.Document; +import org.apache.lucene.index.IndexReader; +import org.apache.lucene.search.Hits; +import org.apache.lucene.search.IndexSearcher; +import org.apache.lucene.search.MatchCollector; +import org.apache.lucene.search.Query; +import org.apache.lucene.store.Directory; + +/** + * Read index using match. + * + *

Other side effects: none. + */ +public abstract class ReadMatchTask extends ReadTask { + + public ReadMatchTask(PerfRunData runData) { + super(runData); + } + + public int doLogic() throws Exception { + int res = 0; + boolean closeReader = false; + + // open reader or use existing one + IndexReader ir = getRunData().getIndexReader(); + if (ir == null) { + Directory dir = getRunData().getDirectory(); + ir = IndexReader.open(dir); + closeReader = true; + //res++; //this is confusing, comment it out + } + + // optionally warm and add num docs traversed to count + if (withWarm()) { + Document doc = null; + for (int m = 0; m < ir.maxDoc(); m++) { + if (!ir.isDeleted(m)) { + doc = ir.document(m); + res += (doc==null ? 0 : 1); + } + } + } + + if (withSearch()) { + res++; + IndexSearcher searcher = new IndexSearcher(ir); + QueryMaker queryMaker = getQueryMaker(); + Query q = queryMaker.makeQuery(); + Hits hits = null; + searcher.match(q, new MatchCollector() { + public void collect(int doc) { + // TODO Auto-generated method stub + } + }); + //System.out.println("searched: "+q); + + if (withTraverse() && hits!=null) { + int traversalSize = Math.min(hits.length(), traversalSize()); + if (traversalSize > 0) { + boolean retrieve = withRetrieve(); + for (int m = 0; m < hits.length(); m++) { + int id = hits.id(m); + res++; + if (retrieve) { + res += retrieveDoc(ir, id); + } + } + } + } + + searcher.close(); + } + + if (closeReader) { + ir.close(); + } + return res; + } + +} Property changes on: src/java/org/apache/lucene/benchmark/byTask/tasks/ReadMatchTask.java ___________________________________________________________________ Name: svn:executable + * Name: svn:eol-style + native Index: src/java/org/apache/lucene/benchmark/byTask/tasks/MatchTask.java =================================================================== --- src/java/org/apache/lucene/benchmark/byTask/tasks/MatchTask.java (revision 0) +++ src/java/org/apache/lucene/benchmark/byTask/tasks/MatchTask.java (revision 0) @@ -0,0 +1,32 @@ +package org.apache.lucene.benchmark.byTask.tasks; + +import org.apache.lucene.benchmark.byTask.PerfRunData; +import org.apache.lucene.benchmark.byTask.feeds.QueryMaker; + +public class MatchTask extends ReadMatchTask { + + public MatchTask(PerfRunData runData) { + super(runData); + } + + public boolean withSearch() { + return true; + } + + public boolean withWarm() { + return false; + } + + public boolean withTraverse() { + return false; + } + + public boolean withRetrieve() { + return false; + } + + public QueryMaker getQueryMaker() { + return getRunData().getQueryMaker(this); + } + +} Property changes on: src/java/org/apache/lucene/benchmark/byTask/tasks/MatchTask.java ___________________________________________________________________ Name: svn:executable + * Name: svn:eol-style + native Index: src/java/org/apache/lucene/benchmark/byTask/tasks/ReadTask.java =================================================================== --- src/java/org/apache/lucene/benchmark/byTask/tasks/ReadTask.java (revision 526500) +++ src/java/org/apache/lucene/benchmark/byTask/tasks/ReadTask.java (working copy) @@ -21,6 +21,7 @@ import org.apache.lucene.benchmark.byTask.feeds.QueryMaker; import org.apache.lucene.document.Document; import org.apache.lucene.index.IndexReader; +import org.apache.lucene.search.HitCollector; import org.apache.lucene.search.Hits; import org.apache.lucene.search.IndexSearcher; import org.apache.lucene.search.Query; @@ -74,7 +75,13 @@ IndexSearcher searcher = new IndexSearcher(ir); QueryMaker queryMaker = getQueryMaker(); Query q = queryMaker.makeQuery(); - Hits hits = searcher.search(q); +// Hits hits = searcher.search(q); + Hits hits = null; + searcher.search(q, new HitCollector() { + public void collect(int docId, float socre) { + // + } + }); //System.out.println("searched: "+q); if (withTraverse() && hits!=null) {