File tree Expand file tree Collapse file tree 7 files changed +35
-7
lines changed
retail/interactive-tutorials/src/main/java/search Expand file tree Collapse file tree 7 files changed +35
-7
lines changed Original file line number Diff line number Diff line change @@ -60,7 +60,11 @@ public static void searchResponse(String defaultSearchPlacementName) throws IOEx
6060 // safely clean up any remaining background resources.
6161 try (SearchServiceClient client = SearchServiceClient .create ()) {
6262 SearchResponse searchResponse = client .search (searchRequest ).getPage ().getResponse ();
63- System .out .println ("Search response: " + searchResponse );
63+ if (searchResponse .getTotalSize () == 0 ) {
64+ System .out .println ("The search operation returned no matching results." );
65+ } else {
66+ System .out .println ("Search response: " + searchResponse );
67+ }
6468 }
6569 }
6670}
Original file line number Diff line number Diff line change @@ -71,7 +71,11 @@ public static void searchResponse(String defaultSearchPlacementName) throws IOEx
7171 // safely clean up any remaining background resources.
7272 try (SearchServiceClient client = SearchServiceClient .create ()) {
7373 SearchResponse searchResponse = client .search (searchRequest ).getPage ().getResponse ();
74- System .out .println ("Search response: " + searchResponse );
74+ if (searchResponse .getTotalSize () == 0 ) {
75+ System .out .println ("The search operation returned no matching results." );
76+ } else {
77+ System .out .println ("Search response: " + searchResponse );
78+ }
7579 }
7680 }
7781}
Original file line number Diff line number Diff line change @@ -62,7 +62,11 @@ public static void searchResponse(String defaultSearchPlacementName) throws IOEx
6262 // safely clean up any remaining background resources.
6363 try (SearchServiceClient client = SearchServiceClient .create ()) {
6464 SearchResponse searchResponse = client .search (searchRequest ).getPage ().getResponse ();
65- System .out .println ("Search response: " + searchResponse );
65+ if (searchResponse .getTotalSize () == 0 ) {
66+ System .out .println ("The search operation returned no matching results." );
67+ } else {
68+ System .out .println ("Search response: " + searchResponse );
69+ }
6670 }
6771 }
6872}
Original file line number Diff line number Diff line change @@ -63,7 +63,11 @@ public static void searchResponse(String defaultSearchPlacementName) throws IOEx
6363 // safely clean up any remaining background resources.
6464 try (SearchServiceClient client = SearchServiceClient .create ()) {
6565 SearchResponse searchResponse = client .search (searchRequest ).getPage ().getResponse ();
66- System .out .println ("Search response: " + searchResponse );
66+ if (searchResponse .getTotalSize () == 0 ) {
67+ System .out .println ("The search operation returned no matching results." );
68+ } else {
69+ System .out .println ("Search response: " + searchResponse );
70+ }
6771 }
6872 }
6973}
Original file line number Diff line number Diff line change @@ -62,7 +62,11 @@ public static void searchResponse(String defaultSearchPlacementName) throws IOEx
6262 // safely clean up any remaining background resources.
6363 try (SearchServiceClient client = SearchServiceClient .create ()) {
6464 SearchResponse searchResponse = client .search (searchRequest ).getPage ().getResponse ();
65- System .out .println ("Search response: " + searchResponse );
65+ if (searchResponse .getTotalSize () == 0 ) {
66+ System .out .println ("The search operation returned no matching results." );
67+ } else {
68+ System .out .println ("Search response: " + searchResponse );
69+ }
6670 }
6771 }
6872}
Original file line number Diff line number Diff line change @@ -65,7 +65,11 @@ public static void searchResponse(String defaultSearchPlacementName) throws IOEx
6565 // safely clean up any remaining background resources.
6666 try (SearchServiceClient client = SearchServiceClient .create ()) {
6767 SearchResponse searchResponseFirstPage = client .search (searchRequest ).getPage ().getResponse ();
68- System .out .println ("Search response: " + searchResponseFirstPage );
68+ if (searchResponseFirstPage .getTotalSize () == 0 ) {
69+ System .out .println ("The search operation returned no matching results." );
70+ } else {
71+ System .out .println ("Search response: " + searchResponseFirstPage );
72+ }
6973
7074 // PASTE CALL WITH NEXT PAGE TOKEN HERE:
7175
Original file line number Diff line number Diff line change @@ -68,7 +68,11 @@ public static void searchResponse(String defaultSearchPlacementName) throws IOEx
6868 // safely clean up any remaining background resources.
6969 try (SearchServiceClient client = SearchServiceClient .create ()) {
7070 SearchResponse searchResponse = client .search (searchRequest ).getPage ().getResponse ();
71- System .out .println ("Search response: " + searchResponse );
71+ if (searchResponse .getTotalSize () == 0 ) {
72+ System .out .println ("The search operation returned no matching results." );
73+ } else {
74+ System .out .println ("Search response: " + searchResponse );
75+ }
7276 }
7377 }
7478}
You can’t perform that action at this time.
0 commit comments