incubator-blur-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From amccu...@apache.org
Subject [1/2] git commit: Fixing parser issue with gis and super queries.
Date Mon, 21 Sep 2015 19:47:15 GMT
Repository: incubator-blur
Updated Branches:
  refs/heads/master e2cc5a733 -> f8c45c380


Fixing parser issue with gis and super queries.


Project: http://git-wip-us.apache.org/repos/asf/incubator-blur/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-blur/commit/828c127b
Tree: http://git-wip-us.apache.org/repos/asf/incubator-blur/tree/828c127b
Diff: http://git-wip-us.apache.org/repos/asf/incubator-blur/diff/828c127b

Branch: refs/heads/master
Commit: 828c127bf2a471dc8750347fad98f31221850ba5
Parents: e2cc5a7
Author: Aaron McCurry <amccurry@gmail.com>
Authored: Mon Sep 21 12:39:17 2015 -0400
Committer: Aaron McCurry <amccurry@gmail.com>
Committed: Mon Sep 21 12:39:17 2015 -0400

----------------------------------------------------------------------
 .../blur/lucene/search/BlurQueryParser.java     |  2 +-
 .../blur/lucene/search/SuperParserTest.java     | 45 ++++++++++++++++++++
 2 files changed, 46 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/828c127b/blur-query/src/main/java/org/apache/blur/lucene/search/BlurQueryParser.java
----------------------------------------------------------------------
diff --git a/blur-query/src/main/java/org/apache/blur/lucene/search/BlurQueryParser.java b/blur-query/src/main/java/org/apache/blur/lucene/search/BlurQueryParser.java
index b611a19..801c73f 100644
--- a/blur-query/src/main/java/org/apache/blur/lucene/search/BlurQueryParser.java
+++ b/blur-query/src/main/java/org/apache/blur/lucene/search/BlurQueryParser.java
@@ -147,7 +147,7 @@ public class BlurQueryParser extends QueryParser {
     try {
       Boolean b = _fieldManager.checkSupportForCustomQuery(resolvedField);
       if (b != null && b) {
-        return _fieldManager.getCustomQuery(resolvedField, term.text());
+        return addField(_fieldManager.getCustomQuery(resolvedField, term.text()), resolvedField);
       }
     } catch (IOException e) {
       throw new RuntimeException(e);

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/828c127b/blur-query/src/test/java/org/apache/blur/lucene/search/SuperParserTest.java
----------------------------------------------------------------------
diff --git a/blur-query/src/test/java/org/apache/blur/lucene/search/SuperParserTest.java b/blur-query/src/test/java/org/apache/blur/lucene/search/SuperParserTest.java
index 782d415..937589f 100644
--- a/blur-query/src/test/java/org/apache/blur/lucene/search/SuperParserTest.java
+++ b/blur-query/src/test/java/org/apache/blur/lucene/search/SuperParserTest.java
@@ -520,6 +520,51 @@ public class SuperParserTest {
     assertQuery(q1, q2);
   }
 
+  @Test
+  public void test45() throws ParseException {
+    SpatialContext ctx = SpatialContext.GEO;
+    int maxLevels = 11;
+    SpatialPrefixTree grid = new GeohashPrefixTree(ctx, maxLevels);
+    RecursivePrefixTreeStrategy strategy = new RecursivePrefixTreeStrategy(grid, "a.id_gis",
false);
+    Circle circle = ctx.makeCircle(-80.0, 33.0, DistanceUtils.dist2Degrees(10, DistanceUtils.EARTH_MEAN_RADIUS_MI));
+    SpatialArgs args = new SpatialArgs(SpatialOperation.Intersects, circle);
+
+    Query q1 = sq(bq(bc_m(strategy.makeQuery(args))));
+    Query q = parseSq("<+a.id_gis:\"Intersects(Circle(33.000000,-80.000000 d=10.0m))\">");
+    boolean equals = q1.equals(q);
+    assertTrue(equals);
+  }
+
+  @Test
+  public void test46() throws ParseException {
+    SpatialContext ctx = SpatialContext.GEO;
+    int maxLevels = 11;
+    SpatialPrefixTree grid = new GeohashPrefixTree(ctx, maxLevels);
+    RecursivePrefixTreeStrategy strategy = new RecursivePrefixTreeStrategy(grid, "a.id_gis",
false);
+    Circle circle = ctx.makeCircle(-80.0, 33.0, DistanceUtils.dist2Degrees(10, DistanceUtils.EARTH_MEAN_RADIUS_MI));
+    SpatialArgs args = new SpatialArgs(SpatialOperation.Intersects, circle);
+
+    Query q1 = sq(bq(bc_m(strategy.makeQuery(args)), bc(tq("rowid", "12345"))));
+    Query q = parseSq("<+a.id_gis:\"Intersects(Circle(33.000000,-80.000000 d=10.0m))\"
rowid:12345>");
+    boolean equals = q1.equals(q);
+    assertTrue(equals);
+  }
+
+  @Test
+  public void test47() throws ParseException {
+    SpatialContext ctx = SpatialContext.GEO;
+    int maxLevels = 11;
+    SpatialPrefixTree grid = new GeohashPrefixTree(ctx, maxLevels);
+    RecursivePrefixTreeStrategy strategy = new RecursivePrefixTreeStrategy(grid, "a.id_gis",
false);
+    Circle circle = ctx.makeCircle(-80.0, 33.0, DistanceUtils.dist2Degrees(10, DistanceUtils.EARTH_MEAN_RADIUS_MI));
+    SpatialArgs args = new SpatialArgs(SpatialOperation.Intersects, circle);
+
+    Query q1 = sq(strategy.makeQuery(args));
+    Query q = parseSq("<a.id_gis:\"Intersects(Circle(33.000000,-80.000000 d=10.0m))\">");
+    boolean equals = q1.equals(q);
+    assertTrue(equals);
+  }
+
   public static BooleanClause bc_m(Query q) {
     return new BooleanClause(q, Occur.MUST);
   }


Mime
View raw message