Skip to content

A Q&A platform software for teams at any scales. Whether it's a community forum, help center, or knowledge management platform, you can always count on Apache Answer.

fix: update search type

shuai235c69e9b9ef
diff --git a/ui/src/pages/Search/components/SearchItem/index.tsx b/ui/src/pages/Search/components/SearchItem/index.tsx
index e74caa4b..16391771 100644
--- a/ui/src/pages/Search/components/SearchItem/index.tsx
+++ b/ui/src/pages/Search/components/SearchItem/index.tsx
@@ -68,7 +68,7 @@ const Index: FC<Props> = ({ data }) => {
<span
className="float-start me-2 badge text-bg-dark"
style={{ marginTop: '2px' }}>
- {data.object_type === 'question' ? 'Q' : 'A'}
+ {t(data.object_type, { keyPrefix: 'btns' })}
</span>
<Link className="h5 mb-0 link-dark text-break" to={itemUrl}>
<HighlightText text={data.object.title} keywords={keywords} />
diff --git a/ui/src/router/routes.ts b/ui/src/router/routes.ts
index 4b98f205..3e324815 100644
--- a/ui/src/router/routes.ts
+++ b/ui/src/router/routes.ts
@@ -123,9 +123,6 @@ const routes: RouteNode[] = [
{
path: '/search',
page: 'pages/Search',
- guard: () => {
- return guard.googleSnapshotRedirect();
- },
},
// tags
{
diff --git a/ui/src/utils/guard.ts b/ui/src/utils/guard.ts
index 3765d693..59011017 100644
--- a/ui/src/utils/guard.ts
+++ b/ui/src/utils/guard.ts
@@ -391,24 +391,6 @@ export const initAppSettingsStore = async () => {
}
};
-export const googleSnapshotRedirect = () => {
- const gr: TGuardResult = { ok: false };
- const searchStr = new URLSearchParams(window.location.search)?.get('q') || '';
- if (window.location.host !== 'webcache.googleusercontent.com') {
- return gr;
- }
- if (searchStr.indexOf('cache:') === 0 && searchStr.includes(':http')) {
- const redirectUrl = `http${searchStr.split(':http')[1]}`;
- const pathname = redirectUrl.replace(new URL(redirectUrl).origin, '');
-
- gr.ok = false;
- gr.redirect = pathname || '/';
- return gr;
- }
-
- return gr;
-};
-
export const askRedirect = () => {
const queryString = window.location.search;