kopia lustrzana https://github.com/Stopka/fedisearch
Fixed parent feed not found, feed search tuning
rodzic
21e2ac6172
commit
8958ab363a
|
@ -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',
|
||||
|
|
|
@ -44,11 +44,21 @@ export const Feed = objectType({
|
|||
if (!source.parentFeedName || !source.parentFeedDomain) {
|
||||
return null
|
||||
}
|
||||
const parentFeedResult = await elasticClient.get<FeedSource>({
|
||||
index: feedIndex,
|
||||
id: getFeedId(source.parentFeedName, source.parentFeedDomain)
|
||||
})
|
||||
return parentFeedResult._source
|
||||
const parentId = getFeedId(source.parentFeedName, source.parentFeedDomain)
|
||||
try {
|
||||
const parentFeedResult = await elasticClient.get<FeedSource>({
|
||||
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', {
|
||||
|
|
Ładowanie…
Reference in New Issue