use of org.opengis.filter.FilterFactory in project ddf by codice.
the class SolrProviderQuery method contextualLogicalOrThenNotPositiveCase.
@Test
public void contextualLogicalOrThenNotPositiveCase() throws UnsupportedQueryException, IngestException {
createContextualMetacards();
FilterFactory filterFactory = new FilterFactoryImpl();
Filter filter = filterFactory.or(filterFactory.like(filterFactory.property(Metacard.METADATA), Library.FLAGSTAFF_QUERY_PHRASE, DEFAULT_TEST_WILDCARD, DEFAULT_TEST_SINGLE_WILDCARD, DEFAULT_TEST_ESCAPE, false), filterFactory.and(filterFactory.like(filterFactory.property(Metacard.METADATA), "AZ", DEFAULT_TEST_WILDCARD, DEFAULT_TEST_SINGLE_WILDCARD, DEFAULT_TEST_ESCAPE, false), filterFactory.not(filterFactory.like(filterFactory.property(Metacard.METADATA), Library.TAMPA_QUERY_PHRASE, DEFAULT_TEST_WILDCARD, DEFAULT_TEST_SINGLE_WILDCARD, DEFAULT_TEST_ESCAPE, false))));
SourceResponse sourceResponse = provider.query(new QueryRequestImpl(new QueryImpl(filter)));
assertEquals("Failed: ( Flagstaff ) OR ( AZ ) NOT ( ( Tampa ) ) ", ONE_HIT, sourceResponse.getResults().size());
}
use of org.opengis.filter.FilterFactory in project ddf by codice.
the class SolrProviderQuery method testPropertyIsEqualToCaseSensitive.
@Test(expected = UnsupportedQueryException.class)
public void testPropertyIsEqualToCaseSensitive() throws Exception {
deleteAll(provider);
FilterFactory filterFactory = new FilterFactoryImpl();
Filter filter = filterFactory.equal(filterFactory.property(Metacard.TITLE), filterFactory.literal("Mary"), false);
// Expect an exception
queryAndVerifyCount(0, filter, provider);
}
use of org.opengis.filter.FilterFactory in project ddf by codice.
the class SolrProviderQuery method contextualLogicalMultiNotPositiveCase.
@Test
public void contextualLogicalMultiNotPositiveCase() throws UnsupportedQueryException, IngestException {
createContextualMetacards();
FilterFactory filterFactory = new FilterFactoryImpl();
LinkedList<Filter> filters = new LinkedList<>();
filters.add(filterFactory.like(filterFactory.property(Metacard.METADATA), Library.FLAGSTAFF_QUERY_PHRASE, DEFAULT_TEST_WILDCARD, DEFAULT_TEST_SINGLE_WILDCARD, DEFAULT_TEST_ESCAPE, false));
filters.add(filterFactory.not(filterFactory.like(filterFactory.property(Metacard.METADATA), Library.TAMPA_QUERY_PHRASE, DEFAULT_TEST_WILDCARD, DEFAULT_TEST_SINGLE_WILDCARD, DEFAULT_TEST_ESCAPE, false)));
filters.add(filterFactory.not(filterFactory.like(filterFactory.property(Metacard.METADATA), "Pennsylvania", DEFAULT_TEST_WILDCARD, DEFAULT_TEST_SINGLE_WILDCARD, DEFAULT_TEST_ESCAPE, false)));
Filter filter = filterFactory.and(filters);
SourceResponse sourceResponse = provider.query(new QueryRequestImpl(new QueryImpl(filter)));
assertEquals("Did not find Flagstaff NOT Tampa", ONE_HIT, sourceResponse.getResults().size());
}
use of org.opengis.filter.FilterFactory in project ddf by codice.
the class SolrProviderQuery method contextualLogicalNotNegativeCase.
@Test
public void contextualLogicalNotNegativeCase() throws UnsupportedQueryException, IngestException {
createContextualMetacards();
FilterFactory filterFactory = new FilterFactoryImpl();
Filter filter = filterFactory.and(filterFactory.like(filterFactory.property(Metacard.METADATA), Library.FLAGSTAFF_QUERY_PHRASE, DEFAULT_TEST_WILDCARD, DEFAULT_TEST_SINGLE_WILDCARD, DEFAULT_TEST_ESCAPE, false), filterFactory.not(filterFactory.like(filterFactory.property(Metacard.METADATA), Library.AIRPORT_QUERY_PHRASE, DEFAULT_TEST_WILDCARD, DEFAULT_TEST_SINGLE_WILDCARD, DEFAULT_TEST_ESCAPE, false)));
SourceResponse sourceResponse = provider.query(new QueryRequestImpl(new QueryImpl(filter)));
assertEquals("Wrongly found Flagstaff NOT Airport", 0, sourceResponse.getResults().size());
}
use of org.opengis.filter.FilterFactory in project ddf by codice.
the class SolrProviderQuery method contextualLogicalNotPositiveCase.
@Test
public void contextualLogicalNotPositiveCase() throws UnsupportedQueryException, IngestException {
createContextualMetacards();
FilterFactory filterFactory = new FilterFactoryImpl();
Filter filter = filterFactory.and(filterFactory.like(filterFactory.property(Metacard.METADATA), Library.FLAGSTAFF_QUERY_PHRASE, DEFAULT_TEST_WILDCARD, DEFAULT_TEST_SINGLE_WILDCARD, DEFAULT_TEST_ESCAPE, false), filterFactory.not(filterFactory.like(filterFactory.property(Metacard.METADATA), Library.TAMPA_QUERY_PHRASE, DEFAULT_TEST_WILDCARD, DEFAULT_TEST_SINGLE_WILDCARD, DEFAULT_TEST_ESCAPE, false)));
SourceResponse sourceResponse = provider.query(new QueryRequestImpl(new QueryImpl(filter)));
assertEquals("Did not find Flagstaff NOT Tampa", ONE_HIT, sourceResponse.getResults().size());
}
Aggregations