SearchHelper
Stay organized with collections
Save and categorize content based on your preferences.
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
}
Inherited Method Summary
From class
java.lang.Object
boolean
|
equals(Object arg0)
|
final
Class<?>
|
getClass()
|
int
|
hashCode()
|
final
void
|
notify()
|
final
void
|
notifyAll()
|
String
|
toString()
|
final
void
|
wait(long arg0, int arg1)
|
final
void
|
wait(long arg0)
|
final
void
|
wait()
|
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)
Throws
GeneralSecurityException |
|
IOException |
|
public
SearchResponse
search
(String query)
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-03-18 UTC.
[null,null,["Last updated 2025-03-18 UTC."],[],[],null,["# SearchHelper\n\npublic class **SearchHelper** extends Object \nHelper class to serving for items indexed by connectors.\n\nThis class is used to verify that indexed items are served correctly, something that is\nparticularly useful to verify that ACLs are set correctly by connectors and the SDK.\n\nSample usage:\n\n```\n SearchAuthInfo userAuthInfo =\n new SearchAuthInfo(clientSecrets, credentialsDirectory, userEmail);\n SearchHelper searchHelper = SearchHelper.createSearchHelper(\n userAuthInfo,\n searchApplicationId,\n Optional.of(rootUrl));\n SearchResponse response = searchHelper.serving(query);\n for (SearchResult result : response.getResults()) {\n // do something with each result\n }\n \n```\n\n\u003cbr /\u003e\n\n### Public Method Summary\n\n|------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| static [SearchHelper](/workspace/cloud-search/docs/reference/sdk/com/google/enterprise/cloudsearch/sdk/serving/SearchHelper) | [createSearchHelper](/workspace/cloud-search/docs/reference/sdk/com/google/enterprise/cloudsearch/sdk/serving/SearchHelper#createSearchHelper(com.google.enterprise.cloudsearch.sdk.serving.SearchAuthInfo, java.lang.String, java.util.Optional\u003cjava.lang.String\u003e))([SearchAuthInfo](/workspace/cloud-search/docs/reference/sdk/com/google/enterprise/cloudsearch/sdk/serving/SearchAuthInfo) searchAuthInfo, String searchApplicationId, Optional\\\u003cString\\\u003e rootUrl) Factory method for `SearchHelper` objects. |\n| static void | [main](/workspace/cloud-search/docs/reference/sdk/com/google/enterprise/cloudsearch/sdk/serving/SearchHelper#main(java.lang.String[]))(String\\[\\] args) |\n| SearchResponse | [search](/workspace/cloud-search/docs/reference/sdk/com/google/enterprise/cloudsearch/sdk/serving/SearchHelper#search(java.lang.String))(String query) |\n\n### Inherited Method Summary\n\nFrom class java.lang.Object \n\n|------------------|---------------------------|\n| boolean | equals(Object arg0) |\n| final Class\\\u003c?\\\u003e | getClass() |\n| int | hashCode() |\n| final void | notify() |\n| final void | notifyAll() |\n| String | toString() |\n| final void | wait(long arg0, int arg1) |\n| final void | wait(long arg0) |\n| final void | wait() |\n\nPublic Methods\n--------------\n\n#### public static [SearchHelper](/workspace/cloud-search/docs/reference/sdk/com/google/enterprise/cloudsearch/sdk/serving/SearchHelper)\n**createSearchHelper**\n([SearchAuthInfo](/workspace/cloud-search/docs/reference/sdk/com/google/enterprise/cloudsearch/sdk/serving/SearchAuthInfo) searchAuthInfo, String searchApplicationId, Optional\\\u003cString\\\u003e rootUrl)\n\nFactory method for `SearchHelper` objects. \n\n##### Parameters\n\n| searchAuthInfo | object containing the info to authenticate the impersonated user |\n| 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) |\n| rootUrl | URL of the Indexing API |\n|---------------------|-------------------------------------------------------------------------------------------------------------------------------------------|\n\n##### Throws\n\n| GeneralSecurityException | |\n| IOException | |\n|--------------------------|---|\n\n#### public static void\n**main**\n(String\\[\\] args)\n\n\u003cbr /\u003e\n\n##### Parameters\n\n| args | |\n|------|---|\n\n##### Throws\n\n| GeneralSecurityException | |\n| IOException | |\n|--------------------------|---|\n\n#### public SearchResponse\n**search**\n(String query)\n\n\u003cbr /\u003e\n\n##### Parameters\n\n| query | |\n|-------|---|\n\n##### Throws\n\n| IOException | |\n|-------------|---|"]]