I have integrated google drive api using GCP service account to fetch the files, when iam searching any keyword inside a parent folder its giving accurate results but when the search is happening inside child folder results are not matching with google drive search results. I have tried for
corpora:'allDrives',
includeTeamDriveItemsRequired:true,
includeItemsFromAllDrives:true,
supportsAllDrives:true,
below is my code
const driveRes = await driveService.files.list({
q: "trashed=false and ('1QLOnVfHvt_M6P8PGTI5z58IjcYXnIFD8' in parents ) and fullText contains 'analytical'",
fields: 'nextPageToken, files(id, name, mimeType, parents, createdTime, modifiedTime, thumbnailLink)',
spaces: 'drive',
pageSize: pageSize,
pageToken: pageToken,
});
console.log('get-drive-files-impl.searchFileFolderWithContent: ', driveRes.data.files.length); // THIS GIVES 6
Drive search Result
- Any solutions for this, or am I missing anything
-- Edit
My folder ID structure in hierarchical way is
parent folder(1uEO8c63iPtYeP-_mALtff0yKtQb7GY2R) ->
(1. child folder)1QLOnVfHvt_M6P8PGTI5z58IjcYXnIFD8 --
- File A
- File B
- File C
(2. child folder)1JFfSP6TDoEzNC7v_ULuWR9LHC9Yaau7s --
- File A
Strange thing is for this query i.e. searching from root folder via recursive parent search below.
trashed=false and ('1uEO8c63iPtYeP-_mALtff0yKtQb7GY2R' in parents or '1QLOnVfHvt_M6P8PGTI5z58IjcYXnIFD8' in parents or '1JFfSP6TDoEzNC7v_ULuWR9LHC9Yaau7s' in parents) and fullText contains 'analytical'
It gives proper results.
But
trashed=false and '1QLOnVfHvt_M6P8PGTI5z58IjcYXnIFD8' in parents and fullText contains 'analytical'
Gives incorrect result