Apache Solr open-source search software
Removed benchmark code since (a) not done (b) might move to benchmark module? (c) easier dependency management. Perhaps it will return.
David Wayne Smiley34ddc3c6c228
diff --git a/modules/spatial/src/java/org/apache/lucene/spatial/benchmark/IndexShapeTask.java b/modules/spatial/src/java/org/apache/lucene/spatial/benchmark/IndexShapeTask.javadeleted file mode 100644index 559520be7fe..00000000000--- a/modules/spatial/src/java/org/apache/lucene/spatial/benchmark/IndexShapeTask.java+++ /dev/null@@ -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;- }-}diff --git a/modules/spatial/src/java/org/apache/lucene/spatial/benchmark/QueryShapeTask.java b/modules/spatial/src/java/org/apache/lucene/spatial/benchmark/QueryShapeTask.javadeleted file mode 100644index a71ac009eb1..00000000000--- a/modules/spatial/src/java/org/apache/lucene/spatial/benchmark/QueryShapeTask.java+++ /dev/null@@ -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;- }-}diff --git a/modules/spatial/src/java/org/apache/lucene/spatial/benchmark/ShapeGenerator.java b/modules/spatial/src/java/org/apache/lucene/spatial/benchmark/ShapeGenerator.javadeleted file mode 100644index 120519cb49c..00000000000--- a/modules/spatial/src/java/org/apache/lucene/spatial/benchmark/ShapeGenerator.java+++ /dev/null@@ -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;- }-}diff --git a/modules/spatial/src/java/org/apache/lucene/spatial/benchmark/StrategyAware.java b/modules/spatial/src/java/org/apache/lucene/spatial/benchmark/StrategyAware.javadeleted file mode 100644index 9f851f3f101..00000000000--- a/modules/spatial/src/java/org/apache/lucene/spatial/benchmark/StrategyAware.java+++ /dev/null@@ -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();-}