@@ -27,11 +27,11 @@ const Results = ({ searchTerm, results }) => {
27
27
< Box pad = { { bottom : 'medium' } } border = { { side : 'bottom' } } key = { index } >
28
28
< Text size = "small" > { categoryLabel ( doc . sourceInstanceName ) } </ Text >
29
29
{ doc && doc . sourceInstanceName !== 'platforms' ? (
30
- < Link to = { `/${ doc . path } ` } >
30
+ < Link to = { doc . externalLink ? doc . externalLink : `/${ doc . path } ` } >
31
31
< HighlightedText content = { doc . title } positions = { titlePos } />
32
32
</ Link >
33
- ) : (
34
- < Link to = { doc . path } >
33
+ ) : (
34
+ < Link to = { doc . externalLink ? doc . externalLink : doc . path } >
35
35
< HighlightedText content = { doc . title } positions = { titlePos } />
36
36
</ Link >
37
37
) }
@@ -63,6 +63,7 @@ Results.propTypes = {
63
63
tags : PropTypes . string ,
64
64
sourceInstanceName : PropTypes . string ,
65
65
path : PropTypes . string ,
66
+ externalLink :PropTypes . string
66
67
} ) ,
67
68
titlePos : PropTypes . arrayOf ( PropTypes . arrayOf ( PropTypes . number ) )
68
69
. isRequired ,
@@ -118,9 +119,7 @@ const getSearchResults = async (query) => {
118
119
const queryResults =
119
120
( await window . __LUNR__ . __loaded ) &&
120
121
window . __LUNR__ . en . index . search ( query ) ;
121
-
122
122
searchResults = queryResults . map ( ( searchResult ) => {
123
- const doc = window . __LUNR__ . en . store [ searchResult . ref ] ;
124
123
categoryMap [ doc . sourceInstanceName ] = true ;
125
124
return {
126
125
titlePos : getPositions ( searchResult , 'title' ) ,
@@ -161,7 +160,6 @@ const SearchContainer = ({ location }) => {
161
160
const onChange = ( event ) => {
162
161
const { value : newValue } = event . target ;
163
162
setValue ( newValue ) ;
164
-
165
163
// update the URL
166
164
const query = newValue ? `?term=${ encodeURIComponent ( newValue ) } ` : '' ;
167
165
navigate ( `/search/${ query } ` , { replace : true } ) ;
0 commit comments