Removed benchmark code since (a) not done (b) might move to benchmark module? (c) easier dependency management. Perhaps it will return.

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/branches/lucene3795_lsp_spatial_module@1291610 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
David Wayne Smiley 2012-02-21 05:48:19 +00:00
parent a8f8272c27
commit 34ddc3c6c2
4 changed files with 0 additions and 192 deletions

View File

@ -1,71 +0,0 @@
/*
* 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.
*/
package org.apache.lucene.spatial.benchmark;
import org.apache.lucene.benchmark.byTask.PerfRunData;
import org.apache.lucene.benchmark.byTask.tasks.PerfTask;
import org.apache.lucene.benchmark.byTask.utils.Config;
import org.apache.lucene.document.Document;
import org.apache.lucene.document.Field;
import org.apache.lucene.document.StringField;
import org.apache.lucene.index.IndexableField;
import org.apache.lucene.spatial.base.shape.Shape;
import org.apache.lucene.spatial.strategy.SpatialFieldInfo;
import org.apache.lucene.spatial.strategy.SpatialStrategy;
import java.util.UUID;
public abstract class IndexShapeTask<T extends SpatialFieldInfo> extends PerfTask implements StrategyAware<T> {
private ShapeGenerator shapeGenerator;
private int numShapes;
public IndexShapeTask(PerfRunData runData) {
super(runData);
}
@Override
public void setup() throws Exception {
Config config = getRunData().getConfig();
String shapeGeneratorName = config.get("index.shapegenerator", ""); // TODO (cmale) - Setup default shape generator
shapeGenerator = (ShapeGenerator) Class.forName(shapeGeneratorName)
.getConstructor(Config.class)
.newInstance(config);
numShapes = config.get("index.numshapes", 1);
}
@Override
public int doLogic() throws Exception {
SpatialStrategy<T> spatialStrategy = createSpatialStrategy();
T fieldInfo = createFieldInfo();
for (int i = 0; i < numShapes; i++) {
Shape shape = shapeGenerator.generate();
IndexableField[] fields = spatialStrategy.createFields(fieldInfo, shape, true, true);
if (fields == null) {
continue;
}
Document document = new Document();
document.add(new Field("id",UUID.randomUUID().toString(),StringField.TYPE_STORED));
for (IndexableField field : fields) {
document.add(field);
}
getRunData().getIndexWriter().addDocument(document);
}
return 1;
}
}

View File

@ -1,52 +0,0 @@
/*
* 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.
*/
package org.apache.lucene.spatial.benchmark;
import org.apache.lucene.benchmark.byTask.PerfRunData;
import org.apache.lucene.benchmark.byTask.tasks.PerfTask;
import org.apache.lucene.benchmark.byTask.utils.Config;
import org.apache.lucene.search.Query;
import org.apache.lucene.search.TopDocs;
import org.apache.lucene.spatial.base.query.SpatialArgs;
import org.apache.lucene.spatial.base.query.SpatialArgsParser;
import org.apache.lucene.spatial.strategy.SpatialFieldInfo;
public abstract class QueryShapeTask<T extends SpatialFieldInfo> extends PerfTask implements StrategyAware<T> {
private SpatialArgs spatialArgs;
public QueryShapeTask(PerfRunData runData) {
super(runData);
}
@Override
public void setup() {
Config config = getRunData().getConfig();
String rawQuery = config.get("query.shapequery", ""); // TODO (cmale) - Come up with default query
this.spatialArgs = new SpatialArgsParser().parse(rawQuery, getSpatialContext());
}
@Override
public int doLogic() throws Exception {
Query query = createSpatialStrategy().makeQuery(spatialArgs, createFieldInfo());
TopDocs topDocs = getRunData().getIndexSearcher().search(query, 10);
System.out.println("Numfound: " + topDocs.totalHits);
return 1;
}
}

View File

@ -1,37 +0,0 @@
/*
* 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.
*/
package org.apache.lucene.spatial.benchmark;
import org.apache.lucene.benchmark.byTask.utils.Config;
import org.apache.lucene.spatial.base.shape.Shape;
public abstract class ShapeGenerator {
private Config config;
protected ShapeGenerator(Config config) {
this.config = config;
}
public abstract Shape generate();
protected Config getConfig() {
return config;
}
}

View File

@ -1,32 +0,0 @@
/*
* 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.
*/
package org.apache.lucene.spatial.benchmark;
import org.apache.lucene.spatial.base.context.SpatialContext;
import org.apache.lucene.spatial.strategy.SpatialFieldInfo;
import org.apache.lucene.spatial.strategy.SpatialStrategy;
public interface StrategyAware<T extends SpatialFieldInfo> {
T createFieldInfo();
SpatialStrategy<T> createSpatialStrategy();
SpatialContext getSpatialContext();
}