Skip to content

Commit

Permalink
pr corrections
Browse files Browse the repository at this point in the history
  • Loading branch information
rdonigian committed Mar 5, 2025
1 parent 63106bd commit a73c727
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 15 deletions.
5 changes: 1 addition & 4 deletions src/components/language/language.edgedb.repository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,6 @@ export class LanguageEdgeDBRepository

async languageByEth(ethnologueId: ID) {
const ethnologue = e.cast(e.Language.ethnologue, e.uuid(ethnologueId));
const language = e.select(e.Language, () => ({
filter_single: { id: ethnologue.language.id },
}));
return await this.db.run(language.id);
return await this.db.run(ethnologue.language.id);
}
}
1 change: 0 additions & 1 deletion src/components/search/dto/search-results.dto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ const searchableAbstracts = {
TranslationProject,
Product,
PeriodicReport,
EthnologueLanguage,
} as const;

/*******************************************************************************
Expand Down
26 changes: 16 additions & 10 deletions src/components/search/search.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ export class SearchService {
// Add Organization label when searching for Partners we can search for
// Partner by organization name
...(inputTypes.includes('Partner') ? (['Organization'] as const) : []),
// Add EthnologueLanguage label when searching for Languages
...(inputTypes.includes('Language')
? (['EthnologueLanguage'] as const)
: []),
];

// Search for nodes based on input, only returning their id and "type"
Expand All @@ -74,19 +78,21 @@ export class SearchService {
id: node.properties.id,
matchedProps,
}))
// Map Org results to Org & Partner results based on types asked for
.flatMap((result) => {
// Map to be used for search results that don't follow standard pattern, add to this as needed
const inputTypeMap = {
EthnologueLanguage: inputTypes.includes('Language')
? [
{
id: result.id,
type: 'LanguageByEth' as const,
matchedProps: ['ethnologue'] as const,
},
]
: [],
EthnologueLanguage: [
...(inputTypes.includes('EthnologueLanguage') ? [result] : []),
...(inputTypes.includes('Language')
? [
{
id: result.id,
type: 'LanguageByEth' as const,
matchedProps: ['ethnologue'] as const,
},
]
: []),
],
Organization: [
...(inputTypes.includes('Organization') ? [result] : []),
...(inputTypes.includes('Partner')
Expand Down

0 comments on commit a73c727

Please sign in to comment.