Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CORE: broken search issue #357

Merged
merged 1 commit into from
Nov 13, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading