mirror of
https://github.com/omnivore-app/omnivore.git
synced 2026-03-11 08:54:26 +00:00
fix: select readable_content from library_item table if content is requested by search api
This commit is contained in:
parent
626c456364
commit
19ed5501f6
2 changed files with 6 additions and 5 deletions
|
|
@ -596,7 +596,7 @@ export const searchResolver = authorized<
|
|||
>,
|
||||
SearchError,
|
||||
QuerySearchArgs
|
||||
>(async (_obj, params, { uid }) => {
|
||||
>(async (_obj, params, { uid }, info) => {
|
||||
const startCursor = params.after || ''
|
||||
const first = Math.min(params.first || 10, 100) // limit to 100 items
|
||||
|
||||
|
|
@ -605,9 +605,11 @@ export const searchResolver = authorized<
|
|||
return { errorCodes: [SearchErrorCode.QueryTooLong] }
|
||||
}
|
||||
|
||||
const isContentRequested = isFieldInSelectionSet(info, 'content')
|
||||
|
||||
const searchLibraryItemArgs = {
|
||||
includePending: true,
|
||||
includeContent: params.includeContent ?? true, // by default include content for offline use for now
|
||||
includeContent: params.includeContent || isContentRequested,
|
||||
includeDeleted: params.query?.includes('in:trash'),
|
||||
query: params.query,
|
||||
useFolders: params.query?.includes('use:folders'),
|
||||
|
|
@ -698,12 +700,10 @@ export const updatesSinceResolver = authorized<
|
|||
folder || 'all'
|
||||
} updated:${startDate.toISOString()} sort:${sort.by}-${sort.order}`
|
||||
|
||||
const isContentRequested = isFieldInSelectionSet(info, 'content')
|
||||
|
||||
const searchLibraryItemArgs = {
|
||||
includeDeleted: true,
|
||||
query,
|
||||
includeContent: isContentRequested,
|
||||
includeContent: false,
|
||||
}
|
||||
|
||||
const libraryItems = await searchLibraryItems(
|
||||
|
|
|
|||
|
|
@ -577,6 +577,7 @@ export const functionResolvers = {
|
|||
pageType: (item: LibraryItem) => item.itemType,
|
||||
highlightsCount: (item: LibraryItem) => item.highlightAnnotations?.length,
|
||||
...readingProgressHandlers,
|
||||
content: (item: LibraryItem) => item.readableContent,
|
||||
},
|
||||
PageInfo: {
|
||||
async totalCount(
|
||||
|
|
|
|||
Loading…
Reference in a new issue