mirror of https://github.com/apache/lucene.git
LUCENE-4169 mark Lucene spatial classes as @lucene.experimental or @lucene.internal
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1355120 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
8cd27eb9f7
commit
699b7c7843
|
@ -17,7 +17,9 @@
|
|||
|
||||
package org.apache.lucene.spatial;
|
||||
|
||||
|
||||
/**
|
||||
* @lucene.experimental
|
||||
*/
|
||||
public class SimpleSpatialFieldInfo implements SpatialFieldInfo {
|
||||
|
||||
private final String fieldName;
|
||||
|
|
|
@ -19,6 +19,8 @@ package org.apache.lucene.spatial;
|
|||
|
||||
/**
|
||||
* Information the strategy needs for the lucene fields
|
||||
*
|
||||
* @lucene.experimental
|
||||
*/
|
||||
public interface SpatialFieldInfo {
|
||||
}
|
||||
|
|
|
@ -29,6 +29,8 @@ import org.apache.lucene.search.Query;
|
|||
|
||||
/**
|
||||
* must be thread safe
|
||||
*
|
||||
* @lucene.experimental
|
||||
*/
|
||||
public abstract class SpatialStrategy<T extends SpatialFieldInfo> {
|
||||
|
||||
|
@ -64,8 +66,6 @@ public abstract class SpatialStrategy<T extends SpatialFieldInfo> {
|
|||
|
||||
/**
|
||||
* The value source yields a number that is proportional to the distance between the query shape and indexed data.
|
||||
* @param args
|
||||
* @param fieldInfo
|
||||
*/
|
||||
public abstract ValueSource makeValueSource(SpatialArgs args, T fieldInfo);
|
||||
|
||||
|
|
|
@ -23,6 +23,9 @@ import org.apache.lucene.spatial.prefix.tree.SpatialPrefixTree;
|
|||
import org.apache.lucene.spatial.util.ShapeFieldCacheProvider;
|
||||
import org.apache.lucene.util.BytesRef;
|
||||
|
||||
/**
|
||||
* @lucene.internal
|
||||
*/
|
||||
public class PointPrefixTreeFieldCacheProvider extends ShapeFieldCacheProvider<Point> {
|
||||
|
||||
final SpatialPrefixTree grid; //
|
||||
|
|
|
@ -25,7 +25,7 @@ import java.io.Reader;
|
|||
|
||||
|
||||
/**
|
||||
*
|
||||
* @lucene.internal
|
||||
*/
|
||||
class PrefixCellsTokenizer extends Tokenizer {
|
||||
public PrefixCellsTokenizer(Reader input) {
|
||||
|
|
|
@ -39,6 +39,9 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
/**
|
||||
* @lucene.internal
|
||||
*/
|
||||
public abstract class PrefixTreeStrategy extends SpatialStrategy<SimpleSpatialFieldInfo> {
|
||||
protected final SpatialPrefixTree grid;
|
||||
private final Map<String, PointPrefixTreeFieldCacheProvider> provider = new ConcurrentHashMap<String, PointPrefixTreeFieldCacheProvider>();
|
||||
|
@ -73,6 +76,9 @@ public abstract class PrefixTreeStrategy extends SpatialStrategy<SimpleSpatialFi
|
|||
cells.add(grid.getNodes(ctr,grid.getMaxLevels(),false).get(0));
|
||||
}
|
||||
|
||||
//TODO is CellTokenStream supposed to be re-used somehow? see Uwe's comments:
|
||||
// http://code.google.com/p/lucene-spatial-playground/issues/detail?id=4
|
||||
|
||||
String fname = fieldInfo.getFieldName();
|
||||
if( store ) {
|
||||
//TODO figure out how to re-use original string instead of reconstituting it.
|
||||
|
|
|
@ -39,6 +39,8 @@ import java.util.LinkedList;
|
|||
* This filter recursively traverses each grid length and uses methods on {@link Shape} to efficiently know
|
||||
* that all points at a prefix fit in the shape or not to either short-circuit unnecessary traversals or to efficiently
|
||||
* load all enclosed points.
|
||||
*
|
||||
* @lucene.internal
|
||||
*/
|
||||
public class RecursivePrefixTreeFilter extends Filter {
|
||||
|
||||
|
|
|
@ -27,6 +27,8 @@ import org.apache.lucene.spatial.prefix.tree.SpatialPrefixTree;
|
|||
|
||||
/**
|
||||
* Based on {@link RecursivePrefixTreeFilter}.
|
||||
*
|
||||
* @lucene.experimental
|
||||
*/
|
||||
public class RecursivePrefixTreeStrategy extends PrefixTreeStrategy {
|
||||
|
||||
|
|
|
@ -33,6 +33,8 @@ import java.util.List;
|
|||
/**
|
||||
* A basic implementation using a large {@link TermsFilter} of all the nodes from
|
||||
* {@link SpatialPrefixTree#getNodes(com.spatial4j.core.shape.Shape, int, boolean)}.
|
||||
*
|
||||
* @lucene.experimental
|
||||
*/
|
||||
public class TermQueryPrefixTreeStrategy extends PrefixTreeStrategy {
|
||||
|
||||
|
|
|
@ -30,6 +30,8 @@ import java.util.List;
|
|||
|
||||
/**
|
||||
* A SpatialPrefixGrid based on Geohashes. Uses {@link GeohashUtils} to do all the geohash work.
|
||||
*
|
||||
* @lucene.experimental
|
||||
*/
|
||||
public class GeohashPrefixTree extends SpatialPrefixTree {
|
||||
|
||||
|
|
|
@ -28,6 +28,8 @@ import java.util.List;
|
|||
|
||||
/**
|
||||
* Represents a grid cell. These are not necessarily threadsafe, although new Cell("") (world cell) must be.
|
||||
*
|
||||
* @lucene.experimental
|
||||
*/
|
||||
public abstract class Node implements Comparable<Node> {
|
||||
public static final byte LEAF_BYTE = '+';//NOTE: must sort before letters & numbers
|
||||
|
|
|
@ -29,7 +29,9 @@ import java.util.ArrayList;
|
|||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* @lucene.experimental
|
||||
*/
|
||||
public class QuadPrefixTree extends SpatialPrefixTree {
|
||||
|
||||
public static class Factory extends SpatialPrefixTreeFactory {
|
||||
|
|
|
@ -32,6 +32,8 @@ import java.util.List;
|
|||
* variable precision. Each string corresponds to a spatial region.
|
||||
*
|
||||
* Implementations of this class should be thread-safe and immutable once initialized.
|
||||
*
|
||||
* @lucene.experimental
|
||||
*/
|
||||
public abstract class SpatialPrefixTree {
|
||||
|
||||
|
@ -64,7 +66,6 @@ public abstract class SpatialPrefixTree {
|
|||
* See {@link com.spatial4j.core.query.SpatialArgs#getDistPrecision()}.
|
||||
* A grid level looked up via {@link #getLevelForDistance(double)} is returned.
|
||||
*
|
||||
* @param shape
|
||||
* @param precision 0-0.5
|
||||
* @return 1-maxLevels
|
||||
*/
|
||||
|
|
|
@ -24,6 +24,7 @@ import com.spatial4j.core.distance.DistanceUtils;
|
|||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @lucene.experimental
|
||||
*/
|
||||
public abstract class SpatialPrefixTreeFactory {
|
||||
|
||||
|
|
|
@ -28,9 +28,9 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
|
||||
/**
|
||||
*
|
||||
* An implementation of the Lucene ValueSource model to support spatial relevance ranking.
|
||||
*
|
||||
* @lucene.internal
|
||||
*/
|
||||
public class CachedDistanceValueSource extends ValueSource {
|
||||
|
||||
|
|
|
@ -25,6 +25,9 @@ import java.io.IOException;
|
|||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @lucene.internal
|
||||
*/
|
||||
public class CachingDoubleValueSource extends ValueSource {
|
||||
|
||||
final ValueSource source;
|
||||
|
|
|
@ -23,6 +23,7 @@ import org.apache.lucene.index.IndexableField;
|
|||
|
||||
/**
|
||||
* Hold some of the parameters used by solr...
|
||||
* @lucene.experimental
|
||||
*/
|
||||
public class NumericFieldInfo {
|
||||
public int precisionStep = 8; // same as solr default
|
||||
|
|
|
@ -22,6 +22,9 @@ import com.spatial4j.core.shape.Shape;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @lucene.internal
|
||||
*/
|
||||
public class ShapeFieldCache<T extends Shape> {
|
||||
private List<T>[] cache;
|
||||
public int defaultLength;
|
||||
|
|
|
@ -26,6 +26,9 @@ import java.io.IOException;
|
|||
import java.util.WeakHashMap;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
/**
|
||||
* @lucene.internal
|
||||
*/
|
||||
public abstract class ShapeFieldCacheProvider<T extends Shape> {
|
||||
private Logger log = Logger.getLogger(getClass().getName());
|
||||
|
||||
|
|
|
@ -24,7 +24,8 @@ import java.io.IOException;
|
|||
import java.util.Iterator;
|
||||
|
||||
/**
|
||||
* Put a list of strings directly into the token stream
|
||||
* Put a list of strings directly into the token stream.
|
||||
* @lucene.internal
|
||||
*/
|
||||
public final class StringListTokenizer extends TokenStream {
|
||||
|
||||
|
|
|
@ -24,6 +24,9 @@ import org.apache.lucene.analysis.tokenattributes.CharTermAttribute;
|
|||
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* @lucene.internal
|
||||
*/
|
||||
public class TruncateFilter extends TokenFilter {
|
||||
|
||||
private final int maxTokenLength;
|
||||
|
|
|
@ -27,6 +27,9 @@ import org.apache.lucene.util.Bits;
|
|||
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* @lucene.internal
|
||||
*/
|
||||
public class ValueSourceFilter extends Filter {
|
||||
|
||||
final Filter startingFilter;
|
||||
|
|
|
@ -32,9 +32,9 @@ import java.io.IOException;
|
|||
import java.util.Map;
|
||||
|
||||
/**
|
||||
*
|
||||
* An implementation of the Lucene ValueSource model to support spatial relevance ranking.
|
||||
*
|
||||
* @lucene.internal
|
||||
*/
|
||||
public class DistanceValueSource extends ValueSource {
|
||||
|
||||
|
|
|
@ -19,6 +19,9 @@ package org.apache.lucene.spatial.vector;
|
|||
|
||||
import org.apache.lucene.spatial.SpatialFieldInfo;
|
||||
|
||||
/**
|
||||
* @lucene.experimental
|
||||
*/
|
||||
public class TwoDoublesFieldInfo implements SpatialFieldInfo {
|
||||
|
||||
public static final String SUFFIX_X = "__x";
|
||||
|
|
|
@ -38,6 +38,9 @@ import org.apache.lucene.spatial.util.CachingDoubleValueSource;
|
|||
import org.apache.lucene.spatial.util.NumericFieldInfo;
|
||||
import org.apache.lucene.spatial.util.ValueSourceFilter;
|
||||
|
||||
/**
|
||||
* @lucene.experimental
|
||||
*/
|
||||
public class TwoDoublesStrategy extends SpatialStrategy<TwoDoublesFieldInfo> {
|
||||
|
||||
private final NumericFieldInfo finfo;
|
||||
|
|
Loading…
Reference in New Issue