diff --git a/plugins/search/api-report.md b/plugins/search/api-report.md
index 2f9a8fbb77..31d357f10c 100644
--- a/plugins/search/api-report.md
+++ b/plugins/search/api-report.md
@@ -5,20 +5,14 @@
```ts
///
-import { ApiRef } from '@backstage/core-plugin-api';
-import { AsyncState } from 'react-use/lib/useAsync';
import { BackstagePlugin } from '@backstage/core-plugin-api';
import { IconComponent } from '@backstage/core-plugin-api';
import { InputBaseProps } from '@material-ui/core';
-import { JsonObject } from '@backstage/types';
-import { default as React_2 } from 'react';
import { ReactElement } from 'react';
import { ReactNode } from 'react';
import { RouteRef } from '@backstage/core-plugin-api';
import { SearchDocument } from '@backstage/plugin-search-common';
-import { SearchQuery } from '@backstage/plugin-search-common';
import { SearchResult as SearchResult_2 } from '@backstage/plugin-search-common';
-import { SearchResultSet } from '@backstage/plugin-search-common';
// Warning: (ae-missing-release-tag) "DefaultResultListItem" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
@@ -81,19 +75,6 @@ export type HomePageSearchBarProps = Partial<
// @public (undocumented)
export const Router: () => JSX.Element;
-// Warning: (ae-missing-release-tag) "SearchApi" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
-//
-// @public @deprecated (undocumented)
-export interface SearchApi {
- // (undocumented)
- query(query: SearchQuery): Promise;
-}
-
-// Warning: (ae-missing-release-tag) "searchApiRef" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
-//
-// @public @deprecated (undocumented)
-export const searchApiRef: ApiRef;
-
// @public (undocumented)
export type SearchAutocompleteFilterProps = SearchFilterComponentProps & {
filterSelectedOptions?: boolean;
@@ -138,24 +119,6 @@ export const SearchBarNext: ({
// @public
export type SearchBarProps = Partial;
-// Warning: (ae-missing-release-tag) "SearchContextProvider" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
-//
-// @public @deprecated (undocumented)
-export const SearchContextProvider: ({
- initialState,
- children,
-}: React_2.PropsWithChildren<{
- initialState?: SearchContextState | undefined;
-}>) => JSX.Element;
-
-// @public
-export type SearchContextState = {
- term: string;
- types: string[];
- filters: JsonObject;
- pageCursor?: string;
-};
-
// Warning: (ae-missing-release-tag) "SearchFilter" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
@@ -330,13 +293,6 @@ export type SidebarSearchProps = {
icon?: IconComponent;
};
-// Warning: (tsdoc-at-sign-in-word) The "@" character looks like part of a TSDoc tag; use a backslash to escape it
-// Warning: (ae-forgotten-export) The symbol "SearchContextValue" needs to be exported by the entry point index.d.ts
-// Warning: (ae-missing-release-tag) "useSearch" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
-//
-// @public @deprecated (undocumented)
-export const useSearch: () => SearchContextValue;
-
// @public
export function useSearchModal(initialState?: boolean): {
state: {
diff --git a/plugins/search/src/apis.ts b/plugins/search/src/apis.ts
index 096b11bb5e..208ad98b0a 100644
--- a/plugins/search/src/apis.ts
+++ b/plugins/search/src/apis.ts
@@ -14,30 +14,13 @@
* limitations under the License.
*/
-import {
- createApiRef,
- DiscoveryApi,
- IdentityApi,
-} from '@backstage/core-plugin-api';
+import { DiscoveryApi, IdentityApi } from '@backstage/core-plugin-api';
import { ResponseError } from '@backstage/errors';
+import { SearchApi } from '@backstage/plugin-search-react';
import { SearchQuery, SearchResultSet } from '@backstage/plugin-search-common';
import qs from 'qs';
-/**
- * @deprecated import from `@backstage/plugin-search-react` instead
- */
-export const searchApiRef = createApiRef({
- id: 'plugin.search.queryservice',
-});
-
-/**
- * @deprecated import from `@backstage/plugin-search-react` instead
- */
-export interface SearchApi {
- query(query: SearchQuery): Promise;
-}
-
export class SearchClient implements SearchApi {
private readonly discoveryApi: DiscoveryApi;
private readonly identityApi: IdentityApi;
diff --git a/plugins/search/src/components/SearchContext/SearchContext.tsx b/plugins/search/src/components/SearchContext/SearchContext.tsx
deleted file mode 100644
index c87295ab99..0000000000
--- a/plugins/search/src/components/SearchContext/SearchContext.tsx
+++ /dev/null
@@ -1,144 +0,0 @@
-/*
- * Copyright 2021 The Backstage Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import { JsonObject } from '@backstage/types';
-import { useApi, AnalyticsContext } from '@backstage/core-plugin-api';
-import { SearchResultSet } from '@backstage/plugin-search-common';
-import React, {
- createContext,
- PropsWithChildren,
- useCallback,
- useContext,
- useEffect,
- useState,
-} from 'react';
-import useAsync, { AsyncState } from 'react-use/lib/useAsync';
-import usePrevious from 'react-use/lib/usePrevious';
-import { searchApiRef } from '../../apis';
-
-type SearchContextValue = {
- result: AsyncState;
- setTerm: React.Dispatch>;
- setTypes: React.Dispatch>;
- setFilters: React.Dispatch>;
- setPageCursor: React.Dispatch>;
- fetchNextPage?: React.DispatchWithoutAction;
- fetchPreviousPage?: React.DispatchWithoutAction;
-} & SearchContextState;
-
-/**
- * The initial state of `SearchContextProvider`.
- *
- * @public
- */
-export type SearchContextState = {
- term: string;
- types: string[];
- filters: JsonObject;
- pageCursor?: string;
-};
-
-/**
- * @deprecated import from `@backstage/plugin-search-react` instead
- */
-export const SearchContext = createContext(
- undefined,
-);
-
-const searchInitialState: SearchContextState = {
- term: '',
- pageCursor: undefined,
- filters: {},
- types: [],
-};
-
-/**
- * @deprecated import from `@backstage/plugin-search-react` instead
- */
-export const SearchContextProvider = ({
- initialState = searchInitialState,
- children,
-}: PropsWithChildren<{ initialState?: SearchContextState }>) => {
- const searchApi = useApi(searchApiRef);
- const [pageCursor, setPageCursor] = useState(
- initialState.pageCursor,
- );
- const [filters, setFilters] = useState(initialState.filters);
- const [term, setTerm] = useState(initialState.term);
- const [types, setTypes] = useState(initialState.types);
-
- const prevTerm = usePrevious(term);
-
- const result = useAsync(
- () =>
- searchApi.query({
- term,
- filters,
- pageCursor,
- types,
- }),
- [term, filters, types, pageCursor],
- );
-
- const hasNextPage =
- !result.loading && !result.error && result.value?.nextPageCursor;
- const hasPreviousPage =
- !result.loading && !result.error && result.value?.previousPageCursor;
- const fetchNextPage = useCallback(() => {
- setPageCursor(result.value?.nextPageCursor);
- }, [result.value?.nextPageCursor]);
- const fetchPreviousPage = useCallback(() => {
- setPageCursor(result.value?.previousPageCursor);
- }, [result.value?.previousPageCursor]);
-
- useEffect(() => {
- // Any time a term is reset, we want to start from page 0.
- if (term && prevTerm && term !== prevTerm) {
- setPageCursor(undefined);
- }
- }, [term, prevTerm, initialState.pageCursor]);
-
- const value: SearchContextValue = {
- result,
- filters,
- setFilters,
- term,
- setTerm,
- types,
- setTypes,
- pageCursor,
- setPageCursor,
- fetchNextPage: hasNextPage ? fetchNextPage : undefined,
- fetchPreviousPage: hasPreviousPage ? fetchPreviousPage : undefined,
- };
-
- return (
-
-
-
- );
-};
-
-/**
- * @deprecated import from "@backstage/plugin-search-react" instead
- */
-export const useSearch = () => {
- const context = useContext(SearchContext);
- if (context === undefined) {
- throw new Error('useSearch must be used within a SearchContextProvider');
- }
- return context;
-};
diff --git a/plugins/search/src/components/SearchContext/index.tsx b/plugins/search/src/components/SearchContext/index.tsx
deleted file mode 100644
index 8651e661c1..0000000000
--- a/plugins/search/src/components/SearchContext/index.tsx
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * Copyright 2021 The Backstage Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-export {
- SearchContextProvider,
- SearchContext,
- useSearch,
-} from './SearchContext';
-
-export type { SearchContextState } from './SearchContext';
diff --git a/plugins/search/src/index.ts b/plugins/search/src/index.ts
index bfffb9e84c..dccb2ce835 100644
--- a/plugins/search/src/index.ts
+++ b/plugins/search/src/index.ts
@@ -20,9 +20,6 @@
* @packageDocumentation
*/
-export { searchApiRef } from './apis';
-export type { SearchApi } from './apis';
-
export { Filters, FiltersButton } from './components/Filters';
export type { FiltersState } from './components/Filters';
export type { HomePageSearchBarProps } from './components/HomePageComponent';
@@ -31,8 +28,6 @@ export type {
SearchBarBaseProps,
SearchBarProps,
} from './components/SearchBar';
-export { SearchContextProvider, useSearch } from './components/SearchContext';
-export type { SearchContextState } from './components/SearchContext';
export { SearchFilter, SearchFilterNext } from './components/SearchFilter';
export type {
SearchAutocompleteFilterProps,