Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import com.marklogic.client.query.StructuredQueryBuilder.GeospatialOperator;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.w3c.dom.Document;
import org.w3c.dom.Element;

Expand Down Expand Up @@ -132,7 +132,7 @@ private static void buildEnvironment() throws ParserConfigurationException {
Common.propertyWait();
}

@Disabled
@Test
public void testGeospatialRegionQuery() {
QueryManager queryMgr = Common.client.newQueryManager();
StructuredQueryBuilder qb = new StructuredQueryBuilder();
Expand All @@ -143,12 +143,13 @@ public void testGeospatialRegionQuery() {
SearchHandle results = queryMgr.search(qdef, new SearchHandle());

MatchDocumentSummary[] summaries = results.getMatchResults();
assertEquals(1, summaries.length);
for (MatchDocumentSummary summary : summaries) {
assertEquals("mexico.xml", summary.getUri());
}
}

@Disabled
@Test
public void testFloatPrecision() {
QueryManager queryMgr = Common.client.newQueryManager();
StructuredQueryBuilder qb = new StructuredQueryBuilder();
Expand All @@ -163,7 +164,7 @@ public void testFloatPrecision() {
assertEquals(2, summaries.length);
}

@Disabled
@Test
public void testDoublePrecision() {
QueryManager queryMgr = Common.client.newQueryManager();
StructuredQueryBuilder qb = new StructuredQueryBuilder();
Expand All @@ -178,7 +179,7 @@ public void testDoublePrecision() {
assertEquals(1, summaries.length);
}

@Disabled
@Test
public void testGeospatialRegionDoubleQuery() {
String options = "<options xmlns=\"http://marklogic.com/appservices/search\">"
+ " <search-option>filtered</search-option>"
Expand All @@ -193,33 +194,36 @@ public void testGeospatialRegionDoubleQuery() {
StructuredQueryBuilder qb = new StructuredQueryBuilder("geodoubleoptions");

StructuredQueryDefinition qdef;
// The polygon's far corner is at 10.00000001. Float precision cannot tell that apart from a point at 10.0000003,
// but double precision can; a gap as small as 2e-8 is within the server's double-precision tolerance.
final double pointCoordinate = 10.0000003;
qdef = qb.geospatial(qb.geoRegionPath(qb.pathIndex("/country/region"), CoordinateSystem.WGS84DOUBLE), GeospatialOperator.COVERS,
qb.point(10.00000003, 10.00000003));
qb.point(pointCoordinate, pointCoordinate));
SearchHandle results = queryMgr.search(qdef, new SearchHandle());
MatchDocumentSummary[] summaries = results.getMatchResults();
assertEquals(0, summaries.length);

qdef = qb.geospatial(qb.geoRegionPath(qb.pathIndex("/country/region"), CoordinateSystem.WGS84), GeospatialOperator.COVERS,
qb.point(10.00000003, 10.00000003));
qb.point(pointCoordinate, pointCoordinate));
results = queryMgr.search(qdef, new SearchHandle());
summaries = results.getMatchResults();
assertEquals(1, summaries.length);

qdef = qb.geospatial(qb.geoRegionPath(qb.pathIndex("/country/region"), CoordinateSystem.getOther("wgs84", true)), GeospatialOperator.COVERS,
qb.point(10.00000003, 10.00000003));
qb.point(pointCoordinate, pointCoordinate));
results = queryMgr.search(qdef, new SearchHandle());
summaries = results.getMatchResults();
assertEquals(0, summaries.length);

qdef = qb.geospatial(qb.geoRegionPath(qb.pathIndex("/country/region"), CoordinateSystem.getOther("wgs84")), GeospatialOperator.COVERS,
qb.point(10.00000003, 10.00000003));
qb.point(pointCoordinate, pointCoordinate));
results = queryMgr.search(qdef, new SearchHandle());
summaries = results.getMatchResults();
assertEquals(1, summaries.length);
optionsMgr.deleteOptions("geodoubleoptions");
}

@Disabled
@Test
public void testFloatPrecisionCoordinateSystem() {
QueryManager queryMgr = Common.client.newQueryManager();
StructuredQueryBuilder qb = new StructuredQueryBuilder();
Expand All @@ -234,7 +238,7 @@ public void testFloatPrecisionCoordinateSystem() {
assertEquals(2, summaries.length);
}

@Disabled
@Test
public void testDoublePrecisionCoordinateSystem() {
QueryManager queryMgr = Common.client.newQueryManager();
StructuredQueryBuilder qb = new StructuredQueryBuilder();
Expand All @@ -249,7 +253,7 @@ public void testDoublePrecisionCoordinateSystem() {
assertEquals(1, summaries.length);
}

@Disabled
@Test
public void testGeospatialRegionQueryConstraint() {
QueryManager queryMgr = Common.client.newQueryManager();
StructuredQueryBuilder qb = queryMgr.newStructuredQueryBuilder();
Expand Down Expand Up @@ -279,7 +283,7 @@ public void testGeospatialRegionQueryConstraint() {
}
}

@Disabled
@Test
public void testGeospatialRegionQueryOptionsConstraint() {
String options = "<options xmlns=\"http://marklogic.com/appservices/search\">"
+ " <constraint name='geoo'>"
Expand Down
Loading