Search in sources :

Example 21 with SearchResult

use of com.thinkbiganalytics.search.rest.model.SearchResult in project kylo by Teradata.

the class SearchFeedMetadataEsIT method verifySearchResultOnDescription3.

private void verifySearchResultOnDescription3(String term) {
    Response response = given(SearchRestController.BASE).when().get("/?q=" + term);
    response.then().statusCode(HTTP_OK);
    SearchResult searchResult = response.as(SearchResult.class);
    Assert.assertEquals("1", searchResult.getTotalHits().toString());
    Assert.assertEquals("Description", searchResult.getSearchResults().get(0).getHighlights().get(0).getKey());
    Assert.assertEquals("Sample feed for property search - Integration Test - <font style='font-weight:bold'>UPDATEDDESCRIPTION</font>", searchResult.getSearchResults().get(0).getHighlights().get(0).getValue());
}
Also used : Response(com.jayway.restassured.response.Response) SearchResult(com.thinkbiganalytics.search.rest.model.SearchResult)

Example 22 with SearchResult

use of com.thinkbiganalytics.search.rest.model.SearchResult in project kylo by Teradata.

the class SearchCategoryMetadataEsIT method verifySearchResultOnUserProperties2.

private void verifySearchResultOnUserProperties2(String term) {
    Response response = given(SearchRestController.BASE).when().get("/?q=" + term);
    response.then().statusCode(HTTP_OK);
    SearchResult searchResult = response.as(SearchResult.class);
    Assert.assertEquals("0", searchResult.getTotalHits().toString());
}
Also used : Response(com.jayway.restassured.response.Response) SearchResult(com.thinkbiganalytics.search.rest.model.SearchResult)

Example 23 with SearchResult

use of com.thinkbiganalytics.search.rest.model.SearchResult in project kylo by Teradata.

the class SearchCategoryMetadataEsIT method enableMetadataIndexingForFeedAndThenSearchAgain.

private void enableMetadataIndexingForFeedAndThenSearchAgain(String categoryId, String searchTermThatGivesResultsWhenIndexingIsOn) {
    Response response = getCategoryById(categoryId);
    FeedCategory feedCategory = response.as(FeedCategory.class);
    Assert.assertFalse(feedCategory.isAllowIndexing());
    feedCategory.setAllowIndexing(true);
    createCategory(feedCategory);
    waitForSomeTime(TEN_SECONDS_IN_MILLIS);
    Response searchResponse = given(SearchRestController.BASE).when().get("/?q=" + searchTermThatGivesResultsWhenIndexingIsOn);
    searchResponse.then().statusCode(HTTP_OK);
    SearchResult searchResult = searchResponse.as(SearchResult.class);
    verifyCommonPortionOfSearchResultOnCategory(searchResult, new HashSet<>(Collections.singletonList("User properties")));
    String expected = "<table style='border:1px solid black; border-collapse: collapse;'>\n" + "<tr>\n" + "<td style='border:1px solid black;padding: 3px;'><font style='font-style:italic'>name</font></td>\n" + "<td style='border:1px solid black;padding: 3px;'><font style='font-style:italic'>value</font></td>\n" + "</tr>\n" + "<tr>\n" + "<td style='border:1px solid black;padding: 3px;'>\n" + "run mode</td style='border:1px solid black;padding: 3px;'>\n" + "<td style='border:1px solid black;padding: 3px;'>\n" + "AUTO i56 daily</td style='border:1px solid black;padding: 3px;'>\n" + "</tr>\n" + "<tr>\n" + "<td style='border:1px solid black;padding: 3px;'>\n" + "test type</td style='border:1px solid black;padding: 3px;'>\n" + "<td style='border:1px solid black;padding: 3px;'>\n" + "T100 <font style='font-weight:bold'>ad92</font></td style='border:1px solid black;padding: 3px;'>\n" + "</tr>\n" + "</table>";
    Assert.assertEquals(expected, searchResult.getSearchResults().get(0).getHighlights().get(0).getValue());
}
Also used : Response(com.jayway.restassured.response.Response) FeedCategory(com.thinkbiganalytics.feedmgr.rest.model.FeedCategory) SearchResult(com.thinkbiganalytics.search.rest.model.SearchResult)

Example 24 with SearchResult

use of com.thinkbiganalytics.search.rest.model.SearchResult in project kylo by Teradata.

the class SearchCategoryMetadataEsIT method verifySearchResultOnUserProperties1.

private void verifySearchResultOnUserProperties1(String term) {
    Response response = given(SearchRestController.BASE).when().get("/?q=" + term);
    response.then().statusCode(HTTP_OK);
    SearchResult searchResult = response.as(SearchResult.class);
    verifyCommonPortionOfSearchResultOnCategory(searchResult, new HashSet<>(Collections.singletonList("User properties")));
    String expected = "<table style='border:1px solid black; border-collapse: collapse;'>\n" + "<tr>\n" + "<td style='border:1px solid black;padding: 3px;'><font style='font-style:italic'>name</font></td>\n" + "<td style='border:1px solid black;padding: 3px;'><font style='font-style:italic'>value</font></td>\n" + "</tr>\n" + "<tr>\n" + "<td style='border:1px solid black;padding: 3px;'>\n" + "run mode</td style='border:1px solid black;padding: 3px;'>\n" + "<td style='border:1px solid black;padding: 3px;'>\n" + "AUTO i56 daily</td style='border:1px solid black;padding: 3px;'>\n" + "</tr>\n" + "<tr>\n" + "<td style='border:1px solid black;padding: 3px;'>\n" + "test type</td style='border:1px solid black;padding: 3px;'>\n" + "<td style='border:1px solid black;padding: 3px;'>\n" + "T100 <font style='font-weight:bold'>ad92</font></td style='border:1px solid black;padding: 3px;'>\n" + "</tr>\n" + "</table>";
    Assert.assertEquals(expected, searchResult.getSearchResults().get(0).getHighlights().get(0).getValue());
}
Also used : Response(com.jayway.restassured.response.Response) SearchResult(com.thinkbiganalytics.search.rest.model.SearchResult)

Example 25 with SearchResult

use of com.thinkbiganalytics.search.rest.model.SearchResult in project kylo by Teradata.

the class SearchCategoryMetadataEsIT method verifySearchResultOnDescription4.

private void verifySearchResultOnDescription4(String term) {
    Response response = given(SearchRestController.BASE).when().get("/?q=" + term);
    response.then().statusCode(HTTP_OK);
    SearchResult searchResult = response.as(SearchResult.class);
    Assert.assertEquals("0", searchResult.getTotalHits().toString());
}
Also used : Response(com.jayway.restassured.response.Response) SearchResult(com.thinkbiganalytics.search.rest.model.SearchResult)

Aggregations

SearchResult (com.thinkbiganalytics.search.rest.model.SearchResult)30 Response (com.jayway.restassured.response.Response)26 SchemaSearchResultData (com.thinkbiganalytics.search.rest.model.SchemaSearchResultData)3 SearchResultData (com.thinkbiganalytics.search.rest.model.SearchResultData)3 TableSearchResultData (com.thinkbiganalytics.search.rest.model.TableSearchResultData)3 UnknownTypeSearchResultData (com.thinkbiganalytics.search.rest.model.UnknownTypeSearchResultData)3 ArrayList (java.util.ArrayList)3 FeedCategory (com.thinkbiganalytics.feedmgr.rest.model.FeedCategory)2 FeedMetadata (com.thinkbiganalytics.feedmgr.rest.model.FeedMetadata)2 CategoryMetadataSearchResultData (com.thinkbiganalytics.search.rest.model.CategoryMetadataSearchResultData)2 FeedMetadataSearchResultData (com.thinkbiganalytics.search.rest.model.FeedMetadataSearchResultData)2 RestResponseStatus (com.thinkbiganalytics.rest.model.RestResponseStatus)1 ElasticSearchRestSearchHit (com.thinkbiganalytics.search.rest.model.es.ElasticSearchRestSearchHit)1 ApiOperation (io.swagger.annotations.ApiOperation)1 ApiResponses (io.swagger.annotations.ApiResponses)1 HashMap (java.util.HashMap)1 Nonnull (javax.annotation.Nonnull)1 GET (javax.ws.rs.GET)1 Produces (javax.ws.rs.Produces)1 SolrDocument (org.apache.solr.common.SolrDocument)1