Include tags in contract search
This commit is contained in:
parent
83f4fd3555
commit
855256816e
|
@ -122,12 +122,13 @@ function CreatorContractsGrid(props: { contracts: Contract[] }) {
|
|||
function TagContractsGrid(props: { contracts: Contract[] }) {
|
||||
const { contracts } = props
|
||||
|
||||
const contractTags = _.flatMap(contracts, (contract) =>
|
||||
parseTags(contract.question + ' ' + contract.description).map((tag) => ({
|
||||
const contractTags = _.flatMap(contracts, (contract) => {
|
||||
const { tags } = contract
|
||||
return tags.map((tag) => ({
|
||||
tag,
|
||||
contract,
|
||||
}))
|
||||
)
|
||||
})
|
||||
const groupedByTag = _.groupBy(contractTags, ({ tag }) => tag)
|
||||
const byTag = _.mapValues(groupedByTag, (contractTags) =>
|
||||
contractTags.map(({ contract }) => contract)
|
||||
|
@ -210,7 +211,8 @@ export function SearchableGrid(props: {
|
|||
check(c.question) ||
|
||||
check(c.description) ||
|
||||
check(c.creatorName) ||
|
||||
check(c.creatorUsername)
|
||||
check(c.creatorUsername) ||
|
||||
check(c.lowercaseTags.map((tag) => `#${tag}`).join(' '))
|
||||
)
|
||||
|
||||
if (sort === 'newest' || sort === 'all') {
|
||||
|
|
Loading…
Reference in New Issue
Block a user