use of datawave.webservice.query.QueryImpl in project datawave by NationalSecurityAgency.
the class DatawaveSelectorExtractorTest method extractSelectorsLuceneQuery3.
@Test
public void extractSelectorsLuceneQuery3() {
DatawaveSelectorExtractor extractor = new DatawaveSelectorExtractor();
QueryImpl q = new QueryImpl();
q.setQuery("FIELD1:selector1 OR selector2 OR (selector3 AND selector4)");
List<String> selectorList = extractor.extractSelectors(q);
List<String> expected = Lists.newArrayList("selector1", "selector2", "selector3", "selector4");
Assert.assertEquals(expected, selectorList);
}
use of datawave.webservice.query.QueryImpl in project datawave by NationalSecurityAgency.
the class SplitSelectorExtractorTest method extractSelectorsLuceneQuery4.
@Test
public void extractSelectorsLuceneQuery4() {
SplitSelectorExtractor extractor = new SplitSelectorExtractor();
extractor.setSeparatorParameter("delimiter");
QueryImpl q = new QueryImpl();
q.addParameter("delimiter", ",");
q.setQuery("selector1,selector2,selector3");
List<String> selectorList = extractor.extractSelectors(q);
List<String> expected = Lists.newArrayList("selector1", "selector2", "selector3");
Assert.assertEquals(expected, selectorList);
}
use of datawave.webservice.query.QueryImpl in project datawave by NationalSecurityAgency.
the class SplitSelectorExtractorTest method extractSelectorsLuceneQuery3.
@Test
public void extractSelectorsLuceneQuery3() {
SplitSelectorExtractor extractor = new SplitSelectorExtractor();
extractor.setSeparatorCharacter("\0");
QueryImpl q = new QueryImpl();
q.setQuery("selector1\0selector2\0selector3");
List<String> selectorList = extractor.extractSelectors(q);
List<String> expected = Lists.newArrayList("selector1", "selector2", "selector3");
Assert.assertEquals(expected, selectorList);
}
use of datawave.webservice.query.QueryImpl in project datawave by NationalSecurityAgency.
the class CompositeIndexTest method getQueryRangesIterator.
private Iterator getQueryRangesIterator(String queryString, ShardQueryLogic logic) throws Exception {
MultivaluedMap<String, String> params = new MultivaluedMapImpl<>();
params.putSingle(QUERY_STRING, queryString);
params.putSingle(QUERY_NAME, "geoQuery");
params.putSingle(QUERY_LOGIC_NAME, "EventQueryLogic");
params.putSingle(QUERY_PERSISTENCE, "PERSISTENT");
params.putSingle(QUERY_AUTHORIZATIONS, AUTHS);
params.putSingle(QUERY_EXPIRATION, "20200101 000000.000");
params.putSingle(QUERY_BEGIN, BEGIN_DATE);
params.putSingle(QUERY_END, END_DATE);
QueryParameters queryParams = new QueryParametersImpl();
queryParams.validate(params);
Set<Authorizations> auths = new HashSet<>();
auths.add(new Authorizations(AUTHS));
Query query = new QueryImpl();
query.initialize(USER, Arrays.asList(USER_DN), null, queryParams, null);
ShardQueryConfiguration config = ShardQueryConfiguration.create(logic, query);
logic.initialize(config, instance.getConnector("root", PASSWORD), query, auths);
logic.setupQuery(config);
return config.getQueries();
}
use of datawave.webservice.query.QueryImpl in project datawave by NationalSecurityAgency.
the class MultiValueCompositeIndexTest method getResultsIterator.
private Iterator getResultsIterator(String queryString, ShardQueryLogic logic) throws Exception {
MultivaluedMap<String, String> params = new MultivaluedMapImpl<>();
params.putSingle(QUERY_STRING, queryString);
params.putSingle(QUERY_NAME, "geoQuery");
params.putSingle(QUERY_LOGIC_NAME, "EventQueryLogic");
params.putSingle(QUERY_PERSISTENCE, "PERSISTENT");
params.putSingle(QUERY_AUTHORIZATIONS, AUTHS);
params.putSingle(QUERY_EXPIRATION, "20200101 000000.000");
params.putSingle(QUERY_BEGIN, BEGIN_DATE);
params.putSingle(QUERY_END, END_DATE);
QueryParameters queryParams = new QueryParametersImpl();
queryParams.validate(params);
Set<Authorizations> auths = new HashSet<>();
auths.add(new Authorizations(AUTHS));
Query query = new QueryImpl();
query.initialize(USER, Arrays.asList(USER_DN), null, queryParams, null);
ShardQueryConfiguration config = ShardQueryConfiguration.create(logic, query);
logic.initialize(config, instance.getConnector("root", PASSWORD), query, auths);
logic.setupQuery(config);
return logic.getTransformIterator(query);
}
Aggregations