diff --git a/application/src/graphql/server/schema/queries/listFeeds.ts b/application/src/graphql/server/schema/queries/listFeeds.ts index 5ff9471..708df03 100644 --- a/application/src/graphql/server/schema/queries/listFeeds.ts +++ b/application/src/graphql/server/schema/queries/listFeeds.ts @@ -56,7 +56,7 @@ export const listFeeds = extendType({ { script_score: { 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 }, { - filter: { term: { locked: true } }, + filter: { range: { followersCount: { lte: 1 } } }, weight: 0.1 + }, + { + filter: { term: { locked: true } }, + weight: 0.05 } ], query: { simple_query_string: { query: prepareSimpleQuery(query.search), fields: [ - 'name^4', - 'domain^4', + 'name^3', + 'domain^3', 'displayName^3', 'description^2', 'field.value^2', diff --git a/application/src/graphql/server/schema/types/Feed.ts b/application/src/graphql/server/schema/types/Feed.ts index b9fead2..cc39d1d 100644 --- a/application/src/graphql/server/schema/types/Feed.ts +++ b/application/src/graphql/server/schema/types/Feed.ts @@ -44,11 +44,21 @@ export const Feed = objectType({ if (!source.parentFeedName || !source.parentFeedDomain) { return null } - const parentFeedResult = await elasticClient.get({ - index: feedIndex, - id: getFeedId(source.parentFeedName, source.parentFeedDomain) - }) - return parentFeedResult._source + const parentId = getFeedId(source.parentFeedName, source.parentFeedDomain) + try { + const parentFeedResult = await elasticClient.get({ + index: feedIndex, + 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', {