org.apache.lucene.benchmark.byTask.feeds
Class SpatialDocMaker

java.lang.Object
  extended by org.apache.lucene.benchmark.byTask.feeds.DocMaker
      extended by org.apache.lucene.benchmark.byTask.feeds.SpatialDocMaker
All Implemented Interfaces:
Closeable

public class SpatialDocMaker
extends DocMaker

Indexes spatial data according to a configured SpatialStrategy with optional shape transformation via a configured SpatialDocMaker.ShapeConverter. The converter can turn points into circles and bounding boxes, in order to vary the type of indexing performance tests. Unless it's subclass-ed to do otherwise, this class configures a SpatialContext, SpatialPrefixTree, and RecursivePrefixTreeStrategy. The Strategy is made available to a query maker via the static method getSpatialStrategy(int). See spatial.alg for a listing of spatial parameters, in particular those starting with "spatial." and "doc.spatial".


Nested Class Summary
static interface SpatialDocMaker.ShapeConverter
          Converts one shape to another.
 
Nested classes/interfaces inherited from class org.apache.lucene.benchmark.byTask.feeds.DocMaker
DocMaker.DocState
 
Field Summary
static String SPATIAL_FIELD
           
 
Fields inherited from class org.apache.lucene.benchmark.byTask.feeds.DocMaker
BODY_FIELD, bodyValType, BYTES_FIELD, config, DATE_FIELD, DATE_MSEC_FIELD, ID_FIELD, indexProperties, NAME_FIELD, reuseFields, source, TIME_SEC_FIELD, TITLE_FIELD, valType
 
Constructor Summary
SpatialDocMaker()
           
 
Method Summary
static SpatialStrategy getSpatialStrategy(int roundNumber)
          Looks up the SpatialStrategy from the given round -- Config.getRoundNumber().
 Document makeDocument()
          Creates a Document object ready for indexing.
 Document makeDocument(int size)
          Same as DocMaker.makeDocument(), only this method creates a document of the given size input by size.
static SpatialDocMaker.ShapeConverter makeShapeConverter(SpatialStrategy spatialStrategy, Config config, String configKeyPrefix)
          Optionally converts points to circles, and optionally bbox'es result.
static com.spatial4j.core.shape.Shape makeShapeFromString(SpatialStrategy strategy, String name, String shapeStr)
           
protected  SpatialStrategy makeSpatialStrategy(Config config)
          Builds a SpatialStrategy from configuration options.
protected  SpatialStrategy makeSpatialStrategy(Config config, Map<String,String> configMap, com.spatial4j.core.context.SpatialContext ctx)
           
 void setConfig(Config config, ContentSource source)
          Set the configuration parameters of this doc maker.
 
Methods inherited from class org.apache.lucene.benchmark.byTask.feeds.DocMaker
close, getDocState, resetInputs
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SPATIAL_FIELD

public static final String SPATIAL_FIELD
See Also:
Constant Field Values
Constructor Detail

SpatialDocMaker

public SpatialDocMaker()
Method Detail

getSpatialStrategy

public static SpatialStrategy getSpatialStrategy(int roundNumber)
Looks up the SpatialStrategy from the given round -- Config.getRoundNumber(). It's an error if it wasn't created already for this round -- when SpatialDocMaker is initialized.


makeSpatialStrategy

protected SpatialStrategy makeSpatialStrategy(Config config)
Builds a SpatialStrategy from configuration options.


makeSpatialStrategy

protected SpatialStrategy makeSpatialStrategy(Config config,
                                              Map<String,String> configMap,
                                              com.spatial4j.core.context.SpatialContext ctx)

setConfig

public void setConfig(Config config,
                      ContentSource source)
Description copied from class: DocMaker
Set the configuration parameters of this doc maker.

Overrides:
setConfig in class DocMaker

makeShapeConverter

public static SpatialDocMaker.ShapeConverter makeShapeConverter(SpatialStrategy spatialStrategy,
                                                                Config config,
                                                                String configKeyPrefix)
Optionally converts points to circles, and optionally bbox'es result.


makeDocument

public Document makeDocument()
                      throws Exception
Description copied from class: DocMaker
Creates a Document object ready for indexing. This method uses the ContentSource to get the next document from the source, and creates a Document object from the returned fields. If reuseFields was set to true, it will reuse Document and Field instances.

Overrides:
makeDocument in class DocMaker
Throws:
Exception

makeShapeFromString

public static com.spatial4j.core.shape.Shape makeShapeFromString(SpatialStrategy strategy,
                                                                 String name,
                                                                 String shapeStr)

makeDocument

public Document makeDocument(int size)
                      throws Exception
Description copied from class: DocMaker
Same as DocMaker.makeDocument(), only this method creates a document of the given size input by size.

Overrides:
makeDocument in class DocMaker
Throws:
Exception


Copyright © 2000-2014 Apache Software Foundation. All Rights Reserved.