Skip to content

Latest commit

 

History

History
121 lines (83 loc) · 9.59 KB

README.md

File metadata and controls

121 lines (83 loc) · 9.59 KB

Search

Overview

Available Operations

query

Search your organization's connected content and return ranked document results with cursor pagination. Use GET /api/search/filters to discover datasource identifiers and common filter fields. Built-in filter names are validated; other field names are accepted as custom filters and behavior depends on your Glean configuration and connected sources. Errors: HTTP 422 unprocessable_query returns no results or next_cursor. See warnings on the response for non-blocking issues such as partially available results. Not every query issue produces a warning or error.

Example Usage

package hello.world;

import com.glean.api_client.glean_api_client.Glean;
import com.glean.api_client.glean_api_client.models.components.PlatformSearchRequest;
import com.glean.api_client.glean_api_client.models.errors.PlatformProblemDetailException;
import com.glean.api_client.glean_api_client.models.operations.PlatformSearchResponse;
import java.lang.Exception;

public class Application {

    public static void main(String[] args) throws PlatformProblemDetailException, Exception {

        Glean sdk = Glean.builder()
                .apiToken(System.getenv().getOrDefault("GLEAN_API_TOKEN", ""))
            .build();

        PlatformSearchRequest req = PlatformSearchRequest.builder()
                .query("quarterly planning 2026")
                .build();

        PlatformSearchResponse res = sdk.search().query()
                .request(req)
                .call();

        if (res.platformSearchResponse().isPresent()) {
            System.out.println(res.platformSearchResponse().get());
        }
    }
}

Parameters

Parameter Type Required Description
request PlatformSearchRequest ✔️ The request object to use for the request.

Response

PlatformSearchResponse

Errors

Error Type Status Code Content Type
models/errors/PlatformProblemDetailException 400, 401, 403, 404, 408, 413, 422, 429 application/problem+json
models/errors/PlatformProblemDetailException 500, 503 application/problem+json
models/errors/APIException 4XX, 5XX */*

listFilters

List datasources and common built-in filter fields visible to the authenticated user. This is a best-effort catalog, not an exhaustive list of every filter search accepts. Without query, returns field metadata only and does not run a search. With a nonblank query, provide exactly one datasources value to request suggested filter values for that query; no documents are returned and this endpoint does not include warning objects. See FilterFieldInfo.values for limitations on suggested values. Rate-limited requests return HTTP 429 with Retry-After; temporary backend unavailability returns HTTP 503.

Example Usage

package hello.world;

import com.glean.api_client.glean_api_client.Glean;
import com.glean.api_client.glean_api_client.models.errors.PlatformProblemDetailException;
import com.glean.api_client.glean_api_client.models.operations.PlatformSearchFiltersResponse;
import java.lang.Exception;

public class Application {

    public static void main(String[] args) throws PlatformProblemDetailException, Exception {

        Glean sdk = Glean.builder()
                .apiToken(System.getenv().getOrDefault("GLEAN_API_TOKEN", ""))
            .build();

        PlatformSearchFiltersResponse res = sdk.search().listFilters()
                .call();

        if (res.platformSearchFiltersResponse().isPresent()) {
            System.out.println(res.platformSearchFiltersResponse().get());
        }
    }
}

Parameters

Parameter Type Required Description
datasources List<String> ➖ Restrict metadata to one or more datasource identifiers as returned by this endpoint (for example, jira). With a nonblank query, exactly one datasource is required. Unknown or inaccessible identifiers return invalid_datasource.
query Optional<String> ➖ Optional search query that requests suggested filter values for the selected datasource. Must be nonblank when present. Triggers a search for facet values only; does not return documents.

Response

PlatformSearchFiltersResponse

Errors

Error Type Status Code Content Type
models/errors/PlatformProblemDetailException 400, 401, 403, 404, 408, 429 application/problem+json
models/errors/PlatformProblemDetailException 500, 503 application/problem+json
models/errors/APIException 4XX, 5XX */*