Need to see if your shared folder is taking up space on your dropbox 👨‍💻? Find out how to check here.

Forum Discussion

yatch999's avatar
yatch999
Explorer | Level 4
5 years ago
Solved

files Search V2 Options Path does not work?

Hi, I'm using JavaScript API on Node.js, it works almost good and smooth.

But I see a strange result on filesSearchV2.

 

My code is like...

 

const files = await dropbox.filesSearchV2({query: keyword,
options: {path: '/' + targetDirectory,
file_status: "active",
filename_only: true}
})
.then(response => {

const metadataFiles = response.result.matches.filter(x => x.metadata.metadata['.tag'] == 'file');

 

// Here is Strange Point.  I set 'path' but this code picks other path's files.  But it's not same as Root.

// I have to check path myself.
const regex = new RegExp(targetDirectory);
const pathFilteredFiles = metadataFiles.filter(x => regex.test(x.metadata.metadata.path_display) == true);

if (pathFilteredFiles)
{
return pathFilteredFiles.map(x => x.metadata.metadata)
} else {
return null;
}
})
.catch(error => {
console.error(error);
});

 

 

I expect searchV2 is focus defined Path.

I referenced following example,

https://www.dropbox.com/developers/documentation/http/documentation#files-search

 

Do I mistake something?

  • This can happen in some cases, as a result of the caching/indexing delay from the Dropbox search backend. That is, if you edit or move a file, you may still see search results for old versions of the file (e.g., at the original path) for some time after the change.

4 Replies

Replies have been turned off for this discussion
  • Greg-DB's avatar
    Greg-DB
    Icon for Dropbox Community Moderator rankDropbox Community Moderator
    5 years ago

    This can happen in some cases, as a result of the caching/indexing delay from the Dropbox search backend. That is, if you edit or move a file, you may still see search results for old versions of the file (e.g., at the original path) for some time after the change.

  • yatch999's avatar
    yatch999
    Explorer | Level 4
    5 years ago

    Hi Greg-DB,

     

    Thanks fast reply, I understand 100%.

     

    You are perfectly correct, I moved my files to the other path, where was picked up by SeachV2 API, also other my duplicated (for testing) files were ignored.  It looked strange, but your information explained all these cases.

     

    I improve my code with your advice.

     

    Many thanks!

  • myfutcard's avatar
    myfutcard
    New member | Level 2
    4 years ago

    But for how long? Multiple hours? I am experiencing this for a LOOOOOONG time now....

  • Greg-DB's avatar
    Greg-DB
    Icon for Dropbox Community Moderator rankDropbox Community Moderator
    4 years ago

    myfutcard The length of the delay depends on a number of different factors, and so can vary over time, as well as across accounts, folders, etc. While in many cases it will not take hours, in some cases it may.

About Discuss Dropbox Developer & API

Node avatar for Discuss Dropbox Developer & API
Make connections with other developers

The Dropbox Community team is active from Monday to Friday. We try to respond to you as soon as we can, usually within 2 hours.

If you need more help you can view your support options (expected response time for an email or ticket is 24 hours), or contact us on X, Facebook or Instagram.

For more info on available support options for your Dropbox plan, see this article.

If you found the answer to your question in this Community thread, please 'like' the post to say thanks and to let us know it was useful!