Fixed parent feed not found, feed search tuning

main
Štěpán Škorpil 2022-09-15 21:20:40 +02:00
rodzic 21e2ac6172
commit 8958ab363a
2 zmienionych plików z 23 dodań i 9 usunięć

Wyświetl plik

@ -56,7 +56,7 @@ export const listFeeds = extendType({
{ {
script_score: { script_score: {
script: { script: {
source: "Math.max(1,Math.log(1 + doc['followersCount'].value) / 10 + 1)" source: "Math.max(1,Math.log(1 + doc['followersCount'].value) / 1 + 1)"
} }
} }
}, },
@ -65,16 +65,20 @@ export const listFeeds = extendType({
weight: 0.8 weight: 0.8
}, },
{ {
filter: { term: { locked: true } }, filter: { range: { followersCount: { lte: 1 } } },
weight: 0.1 weight: 0.1
},
{
filter: { term: { locked: true } },
weight: 0.05
} }
], ],
query: { query: {
simple_query_string: { simple_query_string: {
query: prepareSimpleQuery(query.search), query: prepareSimpleQuery(query.search),
fields: [ fields: [
'name^4', 'name^3',
'domain^4', 'domain^3',
'displayName^3', 'displayName^3',
'description^2', 'description^2',
'field.value^2', 'field.value^2',

Wyświetl plik

@ -44,11 +44,21 @@ export const Feed = objectType({
if (!source.parentFeedName || !source.parentFeedDomain) { if (!source.parentFeedName || !source.parentFeedDomain) {
return null return null
} }
const parentFeedResult = await elasticClient.get<FeedSource>({ const parentId = getFeedId(source.parentFeedName, source.parentFeedDomain)
index: feedIndex, try {
id: getFeedId(source.parentFeedName, source.parentFeedDomain) const parentFeedResult = await elasticClient.get<FeedSource>({
}) index: feedIndex,
return parentFeedResult._source id: parentId
})
return parentFeedResult._source
} catch (error) {
console.warn('Parent feed not found', {
feedId: getFeedId(source.name, source.domain),
parentId,
error
})
return null
}
} }
}) })
t.nonNull.list.nonNull.field('fields', { t.nonNull.list.nonNull.field('fields', {