Skip to content

Commit 0a62f3e

Browse files
authored
feat(search): increase Algolia search results and externalize config (#825)
This PR makes two key improvements to our Algolia search implementation: 1. Increases Maximum Results - Added maxResultsPerGroup parameter to Algolia search component - Increased limit from default to 20 results per group - Improves search experience by showing more relevant matches 2. Configuration Refactoring - Moved Algolia credentials (appId, indexName, apiKey) to centralized searchMetadata config - Improves maintainability by consolidating search settings in one location - Makes configuration updates more manageable ### Testing Manually after merge
1 parent a3170b5 commit 0a62f3e

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

src/components/search/Search.tsx

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { useEffect, useState } from 'react';
2-
2+
import { searchMetadata } from '../../data/search';
33
import { DocSearch } from './docsearch/DocSearch';
44
import './docsearch/docsearch.css';
55

@@ -24,12 +24,14 @@ export const Search = () => {
2424
}, []);
2525

2626
const initialQuery = getInitialQuery();
27+
const { algoliaConfig } = searchMetadata;
2728
return (
2829
<DocSearch
29-
appId="0EBA2NRQU3"
30-
indexName="sourcegraph"
31-
apiKey="1b6e51c1d4ef24bef0a5f1ab00dad80a"
30+
appId={algoliaConfig.appId}
31+
indexName={algoliaConfig.indexName}
32+
apiKey={algoliaConfig.apiKey}
3233
initialQuery={initialQuery}
34+
maxResultsPerGroup={algoliaConfig.maxResultsPerGroup}
3335
/>
3436
);
3537
};

src/data/search.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,6 @@ export const searchMetadata = {
1111
// Public API key: it is safe to commit it
1212
apiKey: '1b6e51c1d4ef24bef0a5f1ab00dad80a',
1313
indexName: 'sourcegraph',
14+
maxResultsPerGroup:20
1415
},
1516
}

0 commit comments

Comments
 (0)