You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucenenet.apache.org by pn...@apache.org on 2012/09/24 05:02:24 UTC

svn commit: r1389190 - in /lucene.net/branches/3.0.3: ./ build/ build/scripts/Spatial.NTS/ lib/ src/ src/contrib/FastVectorHighlighter/ src/contrib/Spatial/BBox/ src/contrib/Spatial/Prefix/ src/contrib/Spatial/Util/ src/contrib/Spatial/Vector/ test-fil...

Author: pnasser
Date: Mon Sep 24 03:02:22 2012
New Revision: 1389190

URL: http://svn.apache.org/viewvc?rev=1389190&view=rev
Log:
Merging trunk changes into 3.0.3 

Added:
    lucene.net/branches/3.0.3/src/contrib/FastVectorHighlighter/StringUtils.cs
      - copied unchanged from r1389184, lucene.net/branches/3.0.3/src/contrib/FastVectorHighlighter/StringUtils.cs
    lucene.net/branches/3.0.3/src/contrib/Spatial/BBox/DistanceSimilarity.cs
    lucene.net/branches/3.0.3/test/contrib/FastVectorHighlighter/StringUtilsTest.cs
      - copied unchanged from r1389184, lucene.net/branches/3.0.3/test/contrib/FastVectorHighlighter/StringUtilsTest.cs
Removed:
    lucene.net/branches/3.0.3/build/scripts/Spatial.NTS/
    lucene.net/branches/3.0.3/src/contrib/Spatial/Prefix/PrefixCellsTokenizer.cs
    lucene.net/branches/3.0.3/src/contrib/Spatial/Util/OpenBitSetIterator.cs
    lucene.net/branches/3.0.3/src/contrib/Spatial/Vector/TwoDoublesStrategy.cs
    lucene.net/branches/3.0.3/test-files/spatial/cities-IsWithin-BBox.txt
    lucene.net/branches/3.0.3/test/contrib/Spatial/Contrib.Spatial.NTS.Tests.csproj
    lucene.net/branches/3.0.3/test/contrib/Spatial/Various.cs
Modified:
    lucene.net/branches/3.0.3/   (props changed)
    lucene.net/branches/3.0.3/ACKNOWLEDGEMENTS.txt   (props changed)
    lucene.net/branches/3.0.3/CHANGES.txt   (props changed)
    lucene.net/branches/3.0.3/README.txt   (props changed)
    lucene.net/branches/3.0.3/build/   (props changed)
    lucene.net/branches/3.0.3/lib/   (props changed)
    lucene.net/branches/3.0.3/src/   (props changed)
    lucene.net/branches/3.0.3/test/   (props changed)
    lucene.net/branches/3.0.3/test-files/   (props changed)
    lucene.net/branches/3.0.3/test/contrib/Spatial/Contrib.Spatial.Tests.csproj

Propchange: lucene.net/branches/3.0.3/
------------------------------------------------------------------------------
  Merged /lucene.net/branches/3.0.3:r1389173-1389184

Propchange: lucene.net/branches/3.0.3/ACKNOWLEDGEMENTS.txt
------------------------------------------------------------------------------
  Merged /lucene.net/branches/3.0.3/ACKNOWLEDGEMENTS.txt:r1389173-1389184

Propchange: lucene.net/branches/3.0.3/CHANGES.txt
------------------------------------------------------------------------------
    svn:mergeinfo = /lucene.net/branches/3.0.3/CHANGES.txt:1389173-1389184

Propchange: lucene.net/branches/3.0.3/README.txt
------------------------------------------------------------------------------
    svn:mergeinfo = /lucene.net/branches/3.0.3/README.txt:1389173-1389184

Propchange: lucene.net/branches/3.0.3/build/
------------------------------------------------------------------------------
  Merged /lucene.net/branches/3.0.3/build:r1389173-1389184

Propchange: lucene.net/branches/3.0.3/lib/
------------------------------------------------------------------------------
    svn:mergeinfo = /lucene.net/branches/3.0.3/lib:1389173-1389184

Propchange: lucene.net/branches/3.0.3/src/
------------------------------------------------------------------------------
  Merged /lucene.net/branches/3.0.3/src:r1389173-1389184

Added: lucene.net/branches/3.0.3/src/contrib/Spatial/BBox/DistanceSimilarity.cs
URL: http://svn.apache.org/viewvc/lucene.net/branches/3.0.3/src/contrib/Spatial/BBox/DistanceSimilarity.cs?rev=1389190&view=auto
==============================================================================
--- lucene.net/branches/3.0.3/src/contrib/Spatial/BBox/DistanceSimilarity.cs (added)
+++ lucene.net/branches/3.0.3/src/contrib/Spatial/BBox/DistanceSimilarity.cs Mon Sep 24 03:02:22 2012
@@ -0,0 +1,63 @@
+/*
+ * 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.
+ */
+
+using Lucene.Net.Search;
+using Spatial4n.Core.Context;
+using Spatial4n.Core.Distance;
+using Spatial4n.Core.Shapes;
+
+namespace Lucene.Net.Spatial.BBox
+{
+    /// <summary>
+    /// Returns the distance between the center of the indexed rectangle and the
+    /// query shape.
+    /// </summary>
+    public class DistanceSimilarity : BBoxSimilarity
+    {
+        private readonly Point queryPoint;
+        private readonly DistanceCalculator distCalc;
+        private readonly double nullValue;
+
+        public DistanceSimilarity(SpatialContext ctx, Point queryPoint)
+        {
+            this.queryPoint = queryPoint;
+            this.distCalc = ctx.GetDistCalc();
+            this.nullValue = (ctx.IsGeo() ? 180 : double.MaxValue);
+        }
+
+        public double Score(Rectangle indexRect, Explanation exp)
+        {
+            double score;
+            if (indexRect == null)
+            {
+                score = nullValue;
+            }
+            else
+            {
+                score = distCalc.Distance(queryPoint, indexRect.GetCenter());
+            }
+            if (exp != null)
+            {
+                exp.Value = (float) score;
+                exp.Description = GetType().Name;
+                exp.AddDetail(new Explanation(-1f, "" + queryPoint));
+                exp.AddDetail(new Explanation(-1f, "" + indexRect));
+            }
+            return score;
+        }
+    }
+}

Propchange: lucene.net/branches/3.0.3/test/
------------------------------------------------------------------------------
  Merged /lucene.net/branches/3.0.3/test:r1389173-1389184

Propchange: lucene.net/branches/3.0.3/test-files/
------------------------------------------------------------------------------
    svn:mergeinfo = /lucene.net/branches/3.0.3/test-files:1389173-1389184

Modified: lucene.net/branches/3.0.3/test/contrib/Spatial/Contrib.Spatial.Tests.csproj
URL: http://svn.apache.org/viewvc/lucene.net/branches/3.0.3/test/contrib/Spatial/Contrib.Spatial.Tests.csproj?rev=1389190&r1=1389189&r2=1389190&view=diff
==============================================================================
--- lucene.net/branches/3.0.3/test/contrib/Spatial/Contrib.Spatial.Tests.csproj (original)
+++ lucene.net/branches/3.0.3/test/contrib/Spatial/Contrib.Spatial.Tests.csproj Mon Sep 24 03:02:22 2012
@@ -104,9 +104,9 @@
     <Reference Include="nunit.framework">
       <HintPath>..\..\..\lib\NUnit.org\NUnit\2.5.9\bin\net-2.0\framework\nunit.framework.dll</HintPath>
     </Reference>
-    <Reference Include="Spatial4n.Core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=9f9456e1ca16d45e, processorArchitecture=MSIL">
+    <Reference Include="Spatial4n.Core.NTS, Version=0.3.0.0, Culture=neutral, PublicKeyToken=9f9456e1ca16d45e, processorArchitecture=MSIL">
       <SpecificVersion>False</SpecificVersion>
-      <HintPath>..\..\..\lib\Spatial4n\$(Framework)\Spatial4n.Core.dll</HintPath>
+      <HintPath>..\..\..\build\bin\contrib\Spatial\Debug\NET40\Spatial4n.Core.NTS.dll</HintPath>
     </Reference>
     <Reference Include="System" />
     <Reference Condition="'$(Framework)' == 'NET35'" Include="System.Core" />
@@ -119,7 +119,9 @@
       <Link>Paths.cs</Link>
     </Compile>
     <Compile Include="BBox\TestBBoxStrategy.cs" />
+    <Compile Include="CheckHits.cs" />
     <Compile Include="Compatibility\TermsFilterTest.cs" />
+    <Compile Include="DistanceStrategyTest.cs" />
     <Compile Include="PortedSolr3Test.cs" />
     <Compile Include="Prefix\TestRecursivePrefixTreeStrategy.cs" />
     <Compile Include="Prefix\TestTermQueryPrefixGridStrategy.cs" />
@@ -131,7 +133,6 @@
     <Compile Include="SpatialTestQuery.cs" />
     <Compile Include="StrategyTestCase.cs" />
     <Compile Include="TestTestFramework.cs" />
-    <Compile Include="Various.cs" />
     <Compile Include="Vector\TestTwoDoublesStrategy.cs" />
   </ItemGroup>
   <ItemGroup>
@@ -157,9 +158,9 @@
     </BootstrapperPackage>
   </ItemGroup>
   <ItemGroup>
-    <ProjectReference Include="..\..\..\src\contrib\Spatial\Contrib.Spatial.csproj">
-      <Project>{35C347F4-24B2-4BE5-8117-A0E3001551CE}</Project>
-      <Name>Contrib.Spatial</Name>
+    <ProjectReference Include="..\..\..\src\contrib\Spatial\Contrib.Spatial.NTS.csproj">
+      <Project>{02d030d0-c7b5-4561-8bdd-41408b2e2f41}</Project>
+      <Name>Contrib.Spatial.NTS</Name>
     </ProjectReference>
     <ProjectReference Include="..\..\..\src\core\Lucene.Net.csproj">
       <Project>{5D4AD9BE-1FFB-41AB-9943-25737971BF57}</Project>