@Test public void searchByPredictedConcepts() { // Search concept by name client.searchInputs(SearchClause.matchConcept(Concept.forName("cat"))) .getPage(1) .executeSync(); // Search concept by ID client.searchInputs(SearchClause.matchConcept(Concept.forID("ai_mFqxrph2"))) .getPage(1) .executeSync(); // Search multiple concepts client.searchInputs(SearchClause.matchConcept(Concept.forID("cat"))) .and(SearchClause.matchConcept(Concept.forID("cute"))) .getPage(1) .executeSync(); // Search NOT by concept client.searchInputs(SearchClause.matchConcept(Concept.forID("cat").withValue(false))) .getPage(1) .executeSync(); }
@Test public void searchByConcept() { client.searchInputs(SearchClause.matchConcept(Concept.forName("dress"))) .build() .getPage(1) .executeSync(); }
@Test public void searchByConceptAndPrediction() { client.searchInputs() // Matches images we tagged as "cat", and that the API tagged as not having "dog" .ands( SearchClause.matchUserTaggedConcept(Concept.forName("cat")), SearchClause.matchConcept(Concept.forName("dog").withValue(false)) ) .getPage(1) .executeSync(); }
@Retry @Test public void t17b_searchInputsWithModel_complexSearch() { assertSuccess( client.searchInputs(matchConcept(Concept.forID("outdoors23").withValue(true))) .and(SearchClause.matchImageURL(ClarifaiImage.of(METRO_NORTH_IMAGE_URL))) .build() ); }
@Test public void searchANDing() { client.searchInputs() .ands( SearchClause.matchUserTaggedConcept(Concept.forName("cat")), SearchClause.matchConcept(Concept.forName("dog").withValue(false)), SearchClause.matchImageVisually(ClarifaiImage.of("@@sampleTrain")) ) .getPage(1) .executeSync(); }
@Test public void t17e_searchInputsWithModel_geo() { assertSuccess(client.addInputs().plus( ClarifaiInput.forImage(METRO_NORTH_IMAGE_URL) .withGeo(PointF.at(90F, 23F)) )); assertSuccess( client.searchInputs(matchConcept(Concept.forID("outdoors23").withValue(true))) .and(SearchClause.matchImageURL(ClarifaiImage.of(METRO_NORTH_IMAGE_URL))) .and(SearchClause.matchGeo(PointF.at(90F, 23F), Radius.of(5, Radius.Unit.MILE))) .build() ); }