You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucenenet.apache.org by sy...@apache.org on 2012/09/22 19:51:53 UTC
svn commit: r1388855 - in /lucene.net/trunk/src/contrib/Spatial: BBox/
Prefix/ Prefix/Tree/ Queries/ Util/ Vector/
Author: synhershko
Date: Sat Sep 22 17:51:53 2012
New Revision: 1388855
URL: http://svn.apache.org/viewvc?rev=1388855&view=rev
Log:
Couple more updates
Modified:
lucene.net/trunk/src/contrib/Spatial/BBox/BBoxSimilarity.cs
lucene.net/trunk/src/contrib/Spatial/Prefix/PointPrefixTreeFieldCacheProvider.cs
lucene.net/trunk/src/contrib/Spatial/Prefix/PrefixTreeStrategy.cs
lucene.net/trunk/src/contrib/Spatial/Prefix/Tree/GeohashPrefixTree.cs
lucene.net/trunk/src/contrib/Spatial/Prefix/Tree/QuadPrefixTree.cs
lucene.net/trunk/src/contrib/Spatial/Prefix/Tree/SpatialPrefixTreeFactory.cs
lucene.net/trunk/src/contrib/Spatial/Queries/SpatialArgsParser.cs
lucene.net/trunk/src/contrib/Spatial/Util/ShapeFieldCache.cs
lucene.net/trunk/src/contrib/Spatial/Util/ShapeFieldCacheProvider.cs
lucene.net/trunk/src/contrib/Spatial/Vector/TwoDoublesStrategy.cs
Modified: lucene.net/trunk/src/contrib/Spatial/BBox/BBoxSimilarity.cs
URL: http://svn.apache.org/viewvc/lucene.net/trunk/src/contrib/Spatial/BBox/BBoxSimilarity.cs?rev=1388855&r1=1388854&r2=1388855&view=diff
==============================================================================
--- lucene.net/trunk/src/contrib/Spatial/BBox/BBoxSimilarity.cs (original)
+++ lucene.net/trunk/src/contrib/Spatial/BBox/BBoxSimilarity.cs Sat Sep 22 17:51:53 2012
@@ -20,6 +20,9 @@ using Spatial4n.Core.Shapes;
namespace Lucene.Net.Spatial.BBox
{
+ /// <summary>
+ /// Abstraction of the calculation used to determine how similar two Bounding Boxes are.
+ /// </summary>
public interface BBoxSimilarity
{
double Score(Rectangle extent, Explanation exp);
Modified: lucene.net/trunk/src/contrib/Spatial/Prefix/PointPrefixTreeFieldCacheProvider.cs
URL: http://svn.apache.org/viewvc/lucene.net/trunk/src/contrib/Spatial/Prefix/PointPrefixTreeFieldCacheProvider.cs?rev=1388855&r1=1388854&r2=1388855&view=diff
==============================================================================
--- lucene.net/trunk/src/contrib/Spatial/Prefix/PointPrefixTreeFieldCacheProvider.cs (original)
+++ lucene.net/trunk/src/contrib/Spatial/Prefix/PointPrefixTreeFieldCacheProvider.cs Sat Sep 22 17:51:53 2012
@@ -23,6 +23,12 @@ using Spatial4n.Core.Shapes;
namespace Lucene.Net.Spatial.Prefix
{
+ /// <summary>
+ /// Implementation of {@link ShapeFieldCacheProvider} designed for {@link PrefixTreeStrategy}s.
+ ///
+ /// Note, due to the fragmented representation of Shapes in these Strategies, this implementation
+ /// can only retrieve the central {@link Point} of the original Shapes.
+ /// </summary>
public class PointPrefixTreeFieldCacheProvider : ShapeFieldCacheProvider<Point>
{
readonly SpatialPrefixTree grid; //
Modified: lucene.net/trunk/src/contrib/Spatial/Prefix/PrefixTreeStrategy.cs
URL: http://svn.apache.org/viewvc/lucene.net/trunk/src/contrib/Spatial/Prefix/PrefixTreeStrategy.cs?rev=1388855&r1=1388854&r2=1388855&view=diff
==============================================================================
--- lucene.net/trunk/src/contrib/Spatial/Prefix/PrefixTreeStrategy.cs (original)
+++ lucene.net/trunk/src/contrib/Spatial/Prefix/PrefixTreeStrategy.cs Sat Sep 22 17:51:53 2012
@@ -29,11 +29,14 @@ using Lucene.Net.Search.Function;
using Lucene.Net.Spatial.Prefix.Tree;
using Lucene.Net.Spatial.Queries;
using Lucene.Net.Spatial.Util;
-using Spatial4n.Core.Distance;
using Spatial4n.Core.Shapes;
namespace Lucene.Net.Spatial.Prefix
{
+ /// <summary>
+ /// Abstract SpatialStrategy which provides common functionality for those
+ /// Strategys which use {@link SpatialPrefixTree}s
+ /// </summary>
public abstract class PrefixTreeStrategy : SpatialStrategy
{
protected readonly SpatialPrefixTree grid;
Modified: lucene.net/trunk/src/contrib/Spatial/Prefix/Tree/GeohashPrefixTree.cs
URL: http://svn.apache.org/viewvc/lucene.net/trunk/src/contrib/Spatial/Prefix/Tree/GeohashPrefixTree.cs?rev=1388855&r1=1388854&r2=1388855&view=diff
==============================================================================
--- lucene.net/trunk/src/contrib/Spatial/Prefix/Tree/GeohashPrefixTree.cs (original)
+++ lucene.net/trunk/src/contrib/Spatial/Prefix/Tree/GeohashPrefixTree.cs Sat Sep 22 17:51:53 2012
@@ -28,6 +28,9 @@ namespace Lucene.Net.Spatial.Prefix.Tree
/// </summary>
public class GeohashPrefixTree : SpatialPrefixTree
{
+ /// <summary>
+ /// Factory for creating {@link GeohashPrefixTree} instances with useful defaults
+ /// </summary>
public class Factory : SpatialPrefixTreeFactory
{
protected override int GetLevelForDistance(double degrees)
Modified: lucene.net/trunk/src/contrib/Spatial/Prefix/Tree/QuadPrefixTree.cs
URL: http://svn.apache.org/viewvc/lucene.net/trunk/src/contrib/Spatial/Prefix/Tree/QuadPrefixTree.cs?rev=1388855&r1=1388854&r2=1388855&view=diff
==============================================================================
--- lucene.net/trunk/src/contrib/Spatial/Prefix/Tree/QuadPrefixTree.cs (original)
+++ lucene.net/trunk/src/contrib/Spatial/Prefix/Tree/QuadPrefixTree.cs Sat Sep 22 17:51:53 2012
@@ -24,11 +24,17 @@ using Spatial4n.Core.Shapes;
namespace Lucene.Net.Spatial.Prefix.Tree
{
+ /// <summary>
+ /// Implementation of {@link SpatialPrefixTree} which uses a quad tree
+ /// (http://en.wikipedia.org/wiki/Quadtree)
+ /// </summary>
public class QuadPrefixTree : SpatialPrefixTree
{
+ /// <summary>
+ /// Factory for creating {@link QuadPrefixTree} instances with useful defaults
+ /// </summary>
public class Factory : SpatialPrefixTreeFactory
{
-
protected override int GetLevelForDistance(double degrees)
{
var grid = new QuadPrefixTree(ctx, MAX_LEVELS_POSSIBLE);
Modified: lucene.net/trunk/src/contrib/Spatial/Prefix/Tree/SpatialPrefixTreeFactory.cs
URL: http://svn.apache.org/viewvc/lucene.net/trunk/src/contrib/Spatial/Prefix/Tree/SpatialPrefixTreeFactory.cs?rev=1388855&r1=1388854&r2=1388855&view=diff
==============================================================================
--- lucene.net/trunk/src/contrib/Spatial/Prefix/Tree/SpatialPrefixTreeFactory.cs (original)
+++ lucene.net/trunk/src/contrib/Spatial/Prefix/Tree/SpatialPrefixTreeFactory.cs Sat Sep 22 17:51:53 2012
@@ -22,6 +22,10 @@ using Spatial4n.Core.Distance;
namespace Lucene.Net.Spatial.Prefix.Tree
{
+ /// <summary>
+ /// Abstract Factory for creating {@link SpatialPrefixTree} instances with useful
+ /// defaults and passed on configurations defined in a Map.
+ /// </summary>
public abstract class SpatialPrefixTreeFactory
{
private const double DEFAULT_GEO_MAX_DETAIL_KM = 0.001; //1m
Modified: lucene.net/trunk/src/contrib/Spatial/Queries/SpatialArgsParser.cs
URL: http://svn.apache.org/viewvc/lucene.net/trunk/src/contrib/Spatial/Queries/SpatialArgsParser.cs?rev=1388855&r1=1388854&r2=1388855&view=diff
==============================================================================
--- lucene.net/trunk/src/contrib/Spatial/Queries/SpatialArgsParser.cs (original)
+++ lucene.net/trunk/src/contrib/Spatial/Queries/SpatialArgsParser.cs Sat Sep 22 17:51:53 2012
@@ -19,7 +19,6 @@ using System;
using System.Collections.Generic;
using System.Text;
using Spatial4n.Core.Context;
-using Spatial4n.Core.Exceptions;
using Spatial4n.Core.Io;
using Spatial4n.Core.Shapes;
@@ -27,6 +26,9 @@ namespace Lucene.Net.Spatial.Queries
{
public class SpatialArgsParser
{
+ public const String DIST_ERR_PCT = "distErrPct";
+ public const String DIST_ERR = "distErr";
+
/// <summary>
/// Writes a close approximation to the parsed input format.
/// </summary>
@@ -81,8 +83,8 @@ namespace Lucene.Net.Spatial.Queries
if (body.Length > 0)
{
Dictionary<String, String> aa = ParseMap(body);
- args.DistErrPct = ReadDouble(aa["distErrPct"]); aa.Remove("distErrPct");
- args.DistErr = ReadDouble(aa["distErr"]); aa.Remove("distErr");
+ args.DistErrPct = ReadDouble(aa["distErrPct"]); aa.Remove(DIST_ERR_PCT);
+ args.DistErr = ReadDouble(aa["distErr"]); aa.Remove(DIST_ERR);
if (aa.Count != 0)
{
throw new ArgumentException("unused parameters: " + aa);
Modified: lucene.net/trunk/src/contrib/Spatial/Util/ShapeFieldCache.cs
URL: http://svn.apache.org/viewvc/lucene.net/trunk/src/contrib/Spatial/Util/ShapeFieldCache.cs?rev=1388855&r1=1388854&r2=1388855&view=diff
==============================================================================
--- lucene.net/trunk/src/contrib/Spatial/Util/ShapeFieldCache.cs (original)
+++ lucene.net/trunk/src/contrib/Spatial/Util/ShapeFieldCache.cs Sat Sep 22 17:51:53 2012
@@ -20,6 +20,11 @@ using Spatial4n.Core.Shapes;
namespace Lucene.Net.Spatial.Util
{
+ /// <summary>
+ /// Bounded Cache of Shapes associated with docIds. Note, multiple Shapes can be
+ /// associated with a given docId
+ /// </summary>
+ /// <typeparam name="T"></typeparam>
public class ShapeFieldCache<T> where T : Shape
{
private readonly IList<T>[] cache;
Modified: lucene.net/trunk/src/contrib/Spatial/Util/ShapeFieldCacheProvider.cs
URL: http://svn.apache.org/viewvc/lucene.net/trunk/src/contrib/Spatial/Util/ShapeFieldCacheProvider.cs?rev=1388855&r1=1388854&r2=1388855&view=diff
==============================================================================
--- lucene.net/trunk/src/contrib/Spatial/Util/ShapeFieldCacheProvider.cs (original)
+++ lucene.net/trunk/src/contrib/Spatial/Util/ShapeFieldCacheProvider.cs Sat Sep 22 17:51:53 2012
@@ -18,11 +18,18 @@
using System;
using System.Runtime.CompilerServices;
using Lucene.Net.Index;
-using Lucene.Net.Support;
using Spatial4n.Core.Shapes;
namespace Lucene.Net.Spatial.Util
{
+ /// <summary>
+ /// Provides access to a {@link ShapeFieldCache} for a given {@link AtomicReader}.
+ ///
+ /// If a Cache does not exist for the Reader, then it is built by iterating over
+ /// the all terms for a given field, reconstructing the Shape from them, and adding
+ /// them to the Cache.
+ /// </summary>
+ /// <typeparam name="T"></typeparam>
public abstract class ShapeFieldCacheProvider<T> where T : Shape
{
//private Logger log = Logger.getLogger(getClass().getName());
Modified: lucene.net/trunk/src/contrib/Spatial/Vector/TwoDoublesStrategy.cs
URL: http://svn.apache.org/viewvc/lucene.net/trunk/src/contrib/Spatial/Vector/TwoDoublesStrategy.cs?rev=1388855&r1=1388854&r2=1388855&view=diff
==============================================================================
--- lucene.net/trunk/src/contrib/Spatial/Vector/TwoDoublesStrategy.cs (original)
+++ lucene.net/trunk/src/contrib/Spatial/Vector/TwoDoublesStrategy.cs Sat Sep 22 17:51:53 2012
@@ -27,6 +27,16 @@ using Spatial4n.Core.Shapes;
namespace Lucene.Net.Spatial.Vector
{
+ /// <summary>
+ /// Simple {@link SpatialStrategy} which represents Points in two numeric {@link DoubleField}s.
+ ///
+ /// Note, currently only Points can be indexed by this Strategy. At query time, the bounding
+ /// box of the given Shape is used to create {@link NumericRangeQuery}s to efficiently
+ /// find Points within the Shape.
+ ///
+ /// Due to the simple use of numeric fields, this Strategy provides support for sorting by
+ /// distance through {@link DistanceValueSource}
+ /// </summary>
public class TwoDoublesStrategy : SpatialStrategy
{
public static String SUFFIX_X = "__x";