SearchHelper

public class SearchHelper extends Object

Helper class to serving for items indexed by connectors. This class is used to verify that indexed items are served correctly, something that is particularly useful to verify that ACLs are set correctly by connectors and the SDK. Sample usage:

   SearchAuthInfo userAuthInfo =
       new SearchAuthInfo(clientSecrets, credentialsDirectory, userEmail);
   SearchHelper searchHelper = SearchHelper.createSearchHelper(
       userAuthInfo,
       searchApplicationId,
       Optional.of(rootUrl));
   SearchResponse response = searchHelper.serving(query);
   for (SearchResult result : response.getResults()) {
     // do something with each result
   }
 

Public Method Summary

static SearchHelper
createSearchHelper(SearchAuthInfo searchAuthInfo, String searchApplicationId, Optional<String> rootUrl)
Factory method for SearchHelper objects.
static void
main(String[] args)
SearchResponse
search(String query)

Inherited Method Summary

Public Methods

public static SearchHelper createSearchHelper (SearchAuthInfo searchAuthInfo, String searchApplicationId, Optional<String> rootUrl)

Factory method for SearchHelper objects.

Parameters
searchAuthInfo object containing the info to authenticate the impersonated user
searchApplicationId ID of the serving application linked to the data sourced containing the items to serving (this is can be obtained from the Admin console)
rootUrl URL of the Indexing API
Throws
GeneralSecurityException
IOException

public static void main (String[] args)

Parameters
args
Throws
GeneralSecurityException
IOException

public SearchResponse search (String query)

Parameters
query
Throws
IOException