use of datawave.query.language.parser.jexl.LuceneToJexlQueryParser in project datawave by NationalSecurityAgency.
the class CompositeFunctionsTest method testTLDWithLuceneAndIdentifierToLiteralEQJexl.
@Test
public void testTLDWithLuceneAndIdentifierToLiteralEQJexl() throws Exception {
tldEventQueryLogic.setParser(new LuceneToJexlQueryParser());
Map<String, String> extraParameters = new HashMap<>();
extraParameters.put("include.grouping.context", "true");
if (log.isDebugEnabled()) {
log.debug("testWithLucene");
}
// @formatter:off
String[] queryStrings = { "UUID:ANDOLINI AND #JEXL(ETA == 12)" };
@SuppressWarnings("unchecked") List<String>[] expectedLists = new List[] { Collections.singletonList("CORLEONE") };
for (int i = 0; i < queryStrings.length; i++) {
runTestQuery(expectedLists[i], queryStrings[i], format.parse("20091231"), format.parse("20150101"), extraParameters, tldEventQueryLogic);
}
}
use of datawave.query.language.parser.jexl.LuceneToJexlQueryParser in project datawave by NationalSecurityAgency.
the class CompositeFunctionsTest method testTLDWithLuceneAndIdentifierToLiteralLTJexl.
@Test
public void testTLDWithLuceneAndIdentifierToLiteralLTJexl() throws Exception {
tldEventQueryLogic.setParser(new LuceneToJexlQueryParser());
Map<String, String> extraParameters = new HashMap<>();
extraParameters.put("include.grouping.context", "true");
if (log.isDebugEnabled()) {
log.debug("testWithLucene");
}
// @formatter:off
String[] queryStrings = { // family name is ANDOLINI
"UUID:ANDOLINI AND #JEXL(ETA < 15)" };
@SuppressWarnings("unchecked") List<String>[] expectedLists = new List[] { Collections.singletonList("CORLEONE") };
for (int i = 0; i < queryStrings.length; i++) {
runTestQuery(expectedLists[i], queryStrings[i], format.parse("20091231"), format.parse("20150101"), extraParameters, tldEventQueryLogic);
}
}
use of datawave.query.language.parser.jexl.LuceneToJexlQueryParser in project datawave by NationalSecurityAgency.
the class CompositeFunctionsTest method testTLDWithLuceneAndIdentifierToIdentifierJexl.
@Test
public void testTLDWithLuceneAndIdentifierToIdentifierJexl() throws Exception {
tldEventQueryLogic.setParser(new LuceneToJexlQueryParser());
Map<String, String> extraParameters = new HashMap<>();
extraParameters.put("include.grouping.context", "true");
if (log.isDebugEnabled()) {
log.debug("testWithLucene");
}
// @formatter:off
String[] queryStrings = { "UUID:ANDOLINI AND #JEXL(ETA < MAGIC)" };
@SuppressWarnings("unchecked") List<String>[] expectedLists = new List[] { Collections.singletonList("CORLEONE") };
for (int i = 0; i < queryStrings.length; i++) {
runTestQuery(expectedLists[i], queryStrings[i], format.parse("20091231"), format.parse("20150101"), extraParameters, tldEventQueryLogic);
}
}
use of datawave.query.language.parser.jexl.LuceneToJexlQueryParser in project datawave by NationalSecurityAgency.
the class TokensQueryTest method testLuceneField.
@Test
public void testLuceneField() throws Exception {
String token = "nashua yuma";
String query = GroupField.TOKENS.name() + ":\"" + token + "\"~4";
String expect = GroupField.TOKENS.name() + EQ_OP + "'" + token + "'";
this.logic.setParser(new LuceneToJexlQueryParser());
runTest(query, expect);
}
use of datawave.query.language.parser.jexl.LuceneToJexlQueryParser in project datawave by NationalSecurityAgency.
the class GroupingTestWithModel method testGroupingUsingLuceneFunction.
@Test
public void testGroupingUsingLuceneFunction() throws Exception {
Map<String, String> extraParameters = new HashMap<>();
extraParameters.put("group.fields.batch.size", "6");
Date startDate = format.parse("20091231");
Date endDate = format.parse("20150101");
String queryString = "(UUID:C* or UUID:S* ) and #GROUPBY('AG','GEN')";
// @formatter:off
Map<String, Integer> expectedMap = ImmutableMap.<String, Integer>builder().put("FEMALE-18", 2).put("MALE-30", 1).put("MALE-34", 1).put("MALE-16", 1).put("MALE-40", 2).put("MALE-20", 2).put("MALE-24", 1).put("MALE-22", 2).build();
// @formatter:on
logic.setParser(new LuceneToJexlQueryParser());
for (RebuildingScannerTestHelper.TEARDOWN teardown : TEARDOWNS) {
for (RebuildingScannerTestHelper.INTERRUPT interrupt : INTERRUPTS) {
runTestQueryWithGrouping(expectedMap, queryString, startDate, endDate, extraParameters, teardown, interrupt);
}
}
logic.setParser(new JexlControlledQueryParser());
}
Aggregations