use of datawave.query.config.ShardQueryConfiguration in project datawave by NationalSecurityAgency.
the class WhindexVisitorTest method oneToManyMultipleIntersectsTest.
@Test
public void oneToManyMultipleIntersectsTest() throws ParseException {
String query = "geowave:intersects(ICE_CREAM, 'POLYGON((-10 -10, 10 -10, 10 10, -10 10, -10 -10))') && TOPPINGS == 'PEANUT' && (TOPPINGS == 'HOT_FUDGE' || TOPPINGS == 'BANANA')";
ShardQueryConfiguration config = new ShardQueryConfiguration();
config.setWhindexMappingFields(mappingFields);
config.setWhindexFieldMappings(multipleFieldMapping);
ASTJexlScript jexlScript = JexlASTHelper.parseJexlQuery(query);
jexlScript = WhindexVisitor.apply(jexlScript, config, new Date(), metadataHelper);
Assert.assertEquals("(TOPPINGS == 'PEANUT' && geowave:intersects(HOT_FUDGE_SUNDAE, 'POLYGON((-10 -10, 10 -10, 10 10, -10 10, -10 -10))')) || (TOPPINGS == 'PEANUT' && geowave:intersects(BANANA_SPLIT, 'POLYGON((-10 -10, 10 -10, 10 10, -10 10, -10 -10))'))", JexlStringBuildingVisitor.buildQuery(jexlScript));
}
use of datawave.query.config.ShardQueryConfiguration in project datawave by NationalSecurityAgency.
the class WhindexVisitorTest method reverseOneToManyMultipleIntersectsTest.
@Test
public void reverseOneToManyMultipleIntersectsTest() throws ParseException {
String query = "(TOPPINGS == 'HOT_FUDGE' || TOPPINGS == 'BANANA') && TOPPINGS == 'PEANUT' && geowave:intersects(ICE_CREAM, 'POLYGON((-10 -10, 10 -10, 10 10, -10 10, -10 -10))')";
ShardQueryConfiguration config = new ShardQueryConfiguration();
config.setWhindexMappingFields(mappingFields);
config.setWhindexFieldMappings(multipleFieldMapping);
ASTJexlScript jexlScript = JexlASTHelper.parseJexlQuery(query);
jexlScript = WhindexVisitor.apply(jexlScript, config, new Date(), metadataHelper);
Assert.assertEquals("(TOPPINGS == 'PEANUT' && geowave:intersects(HOT_FUDGE_SUNDAE, 'POLYGON((-10 -10, 10 -10, 10 10, -10 10, -10 -10))')) || (TOPPINGS == 'PEANUT' && geowave:intersects(BANANA_SPLIT, 'POLYGON((-10 -10, 10 -10, 10 10, -10 10, -10 -10))'))", JexlStringBuildingVisitor.buildQuery(jexlScript));
}
use of datawave.query.config.ShardQueryConfiguration in project datawave by NationalSecurityAgency.
the class WhindexVisitorTest method manyToManyWithinBoundingBoxTest.
@Test
public void manyToManyWithinBoundingBoxTest() throws ParseException {
String query = "geo:within_bounding_box((ICE_CREAM || SHERBERT), '-10_-10', '10_10') && (TOPPINGS == 'HOT_FUDGE' || TOPPINGS == 'BANANA')";
ShardQueryConfiguration config = new ShardQueryConfiguration();
config.setWhindexMappingFields(mappingFields);
config.setWhindexFieldMappings(multipleFieldMapping);
ASTJexlScript jexlScript = JexlASTHelper.parseJexlQuery(query);
jexlScript = WhindexVisitor.apply(jexlScript, config, new Date(), metadataHelper);
Assert.assertEquals("((TOPPINGS == 'HOT_FUDGE' && geo:within_bounding_box(SHERBERT, '-10_-10', '10_10')) || geo:within_bounding_box(HOT_FUDGE_SUNDAE, '-10_-10', '10_10')) || ((TOPPINGS == 'BANANA' && geo:within_bounding_box(SHERBERT, '-10_-10', '10_10')) || geo:within_bounding_box(BANANA_SPLIT, '-10_-10', '10_10'))", JexlStringBuildingVisitor.buildQuery(jexlScript));
}
use of datawave.query.config.ShardQueryConfiguration in project datawave by NationalSecurityAgency.
the class WhindexVisitorTest method oneToManyIntersectsDistributedGroupedTest.
@Test
public void oneToManyIntersectsDistributedGroupedTest() throws ParseException {
String query = "geowave:intersects(ICE_CREAM, 'POLYGON((-10 -10, 10 -10, 10 10, -10 10, -10 -10))') && (TOPPINGS == 'HOT_FUDGE' || TOPPINGS == 'BANANA' || CONTAINER == 'CONE' || CONTAINER == 'BOWL')";
ShardQueryConfiguration config = new ShardQueryConfiguration();
config.setWhindexMappingFields(mappingFields);
config.setWhindexFieldMappings(multipleFieldMapping);
ASTJexlScript jexlScript = JexlASTHelper.parseJexlQuery(query);
jexlScript = WhindexVisitor.apply(jexlScript, config, new Date(), metadataHelper);
Assert.assertEquals("(geowave:intersects(ICE_CREAM, 'POLYGON((-10 -10, 10 -10, 10 10, -10 10, -10 -10))') && (CONTAINER == 'CONE' || CONTAINER == 'BOWL')) || geowave:intersects(HOT_FUDGE_SUNDAE, 'POLYGON((-10 -10, 10 -10, 10 10, -10 10, -10 -10))') || geowave:intersects(BANANA_SPLIT, 'POLYGON((-10 -10, 10 -10, 10 10, -10 10, -10 -10))')", JexlStringBuildingVisitor.buildQuery(jexlScript));
}
use of datawave.query.config.ShardQueryConfiguration in project datawave by NationalSecurityAgency.
the class WhindexVisitorTest method oneToOneWithinBoundingBoxParensTest.
@Test
public void oneToOneWithinBoundingBoxParensTest() throws ParseException {
String query = "geo:within_bounding_box(ICE_CREAM, '-10_-10', '10_10') && (TOPPINGS == 'HOT_FUDGE')";
ShardQueryConfiguration config = new ShardQueryConfiguration();
config.setWhindexMappingFields(mappingFields);
config.setWhindexFieldMappings(singleFieldMapping);
ASTJexlScript jexlScript = JexlASTHelper.parseJexlQuery(query);
jexlScript = WhindexVisitor.apply(jexlScript, config, new Date(), metadataHelper);
Assert.assertEquals("geo:within_bounding_box(HOT_FUDGE_SUNDAE, '-10_-10', '10_10')", JexlStringBuildingVisitor.buildQuery(jexlScript));
}
Aggregations