use of datawave.data.type.LcNoDiacriticsType in project datawave by NationalSecurityAgency.
the class ExpandMultiNormalizedTermsTest method testNumber.
@Test
public void testNumber() throws ParseException {
Multimap<String, Type<?>> dataTypes = HashMultimap.create();
dataTypes.putAll("MULTI", Sets.newHashSet(new LcNoDiacriticsType(), new NumberType()));
dataTypes.put("NUM", new NumberType());
helper.setIndexedFields(dataTypes.keySet());
helper.setIndexOnlyFields(dataTypes.keySet());
helper.addTermFrequencyFields(dataTypes.keySet());
config.setQueryFieldsDatatypes(dataTypes);
String original = "NUM == '1'";
String expected = "NUM == '+aE1'";
expandTerms(original, expected);
original = "MULTI == '1'";
expected = "(MULTI == '1' || MULTI == '+aE1')";
expandTerms(original, expected);
}
use of datawave.data.type.LcNoDiacriticsType in project datawave by NationalSecurityAgency.
the class ExpandMultiNormalizedTermsTest method testBoundedNormalizedAndUnNormalizedBoundsCase.
@Test
public void testBoundedNormalizedAndUnNormalizedBoundsCase() throws ParseException {
Multimap<String, Type<?>> dataTypes = HashMultimap.create();
dataTypes.put("NEW", new LcNoDiacriticsType());
config.setQueryFieldsDatatypes(dataTypes);
String original = "((_Bounded_ = true) && (NEW > '0' && NEW < '9')) && ((_Bounded_ = true) && (FOO > 1 && FOO < 10))";
String expected = "((_Bounded_ = true) && (NEW > '0' && NEW < '9')) && ((_Bounded_ = true) && (FOO > 1 && FOO < 10))";
expandTerms(original, expected);
}
use of datawave.data.type.LcNoDiacriticsType in project datawave by NationalSecurityAgency.
the class FetchDataTypesVisitorTest method testSingleTermNormalizer.
@Test
public void testSingleTermNormalizer() throws ParseException {
String query = "FOO == 'bar'";
Multimap<String, Type<?>> expected = HashMultimap.create();
expected.put("FOO", new LcNoDiacriticsType());
runTest(query, expected);
}
use of datawave.data.type.LcNoDiacriticsType in project datawave by NationalSecurityAgency.
the class FetchDataTypesVisitorTest method testSingleTermTwoNormalizers.
@Test
public void testSingleTermTwoNormalizers() throws ParseException {
String query = "FOO4 == 'bar'";
Multimap<String, Type<?>> expected = HashMultimap.create();
expected.put("FOO4", new LcType());
expected.put("FOO4", new LcNoDiacriticsType());
runTest(query, expected);
}
use of datawave.data.type.LcNoDiacriticsType in project datawave by NationalSecurityAgency.
the class JexlASTHelperTest method testNormalizeLiteral.
@Test
public void testNormalizeLiteral() throws Throwable {
LcNoDiacriticsType normalizer = new LcNoDiacriticsType();
ASTJexlScript script = JexlASTHelper.parseJexlQuery("F == 'aSTrInG'");
if (log.isDebugEnabled()) {
PrintingVisitor.printQuery(script);
}
JexlNode literal = script.jjtGetChild(0).jjtGetChild(1).jjtGetChild(0);
ASTReference ref = JexlASTHelper.normalizeLiteral(literal, normalizer);
Assert.assertEquals("astring", ref.jjtGetChild(0).image);
}
Aggregations