Skip to content

Commit

Permalink
CORE: broken search issue (#357)
Browse files Browse the repository at this point in the history
  • Loading branch information
ekachxaidze98 authored Nov 13, 2024
1 parent 895aa0f commit e080077
Showing 1 changed file with 10 additions and 23 deletions.
33 changes: 10 additions & 23 deletions templates/search/results.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@ const Results = ({ works, searchId }) =>
const fullTextLink = links.find((l) => l.type === 'download')?.url
const metadataLink = links.find((l) => l.type === 'display')?.url

const urlSearchString = window.location.search

const publicationDate = publishedDate
? formatDate(new Date(publishedDate))
: yearPublished !== null && toString(yearPublished)
Expand Down Expand Up @@ -72,7 +70,6 @@ const Results = ({ works, searchId }) =>
if (innerDownloadLink) return innerDownloadLink
return innerFullTextLink
}

return (
<SearchResult
id={`search-output-${id}`}
Expand All @@ -81,10 +78,7 @@ const Results = ({ works, searchId }) =>
className={styles.searchResults}
useLogo={!!checkBillingType()}
searchId={searchId}
renderRedirectLink={
!urlSearchString.includes('author') &&
!window.location.pathname.includes('data-providers')
}
renderRedirectLink
data={{
workId: id,
title,
Expand All @@ -93,22 +87,15 @@ const Results = ({ works, searchId }) =>
publicationDate: publicationDate || null,
thumbnailUrl: thumbnailLink || `//core.ac.uk/image/${id}/medium`,
metadataLink:
!urlSearchString.includes('author') &&
!window.location.pathname.includes('data-providers')
? generateMetadataLink(metadataLink, searchId, id) ||
generateMetadataLink(displayLink, searchId, id)
: metadataLink || displayLink,
fullTextLink:
!urlSearchString.includes('author') &&
!window.location.pathname.includes('data-providers')
? renderFullTextLink({
fullTextLink,
downloadLink,
modifiedReaderLink,
searchId,
id,
})
: fullTextLink || readerLink || downloadLink,
generateMetadataLink(metadataLink, searchId, id) ||
generateMetadataLink(displayLink, searchId, id),
fullTextLink: renderFullTextLink({
fullTextLink,
downloadLink,
modifiedReaderLink,
searchId,
id,
}),
dataProviders: dataProviders || [],
isRecommended: memberType?.billing_type === 'sustaining',
}}
Expand Down

0 comments on commit e080077

Please sign in to comment.