You might see that the Dropbox Community team have been busy working on some major updates to the Community itself! So, here is some info on what’s changed, what’s staying the same and what you can expect from the Dropbox Community overall.
Forum Discussion
sbrownnw
2 years agoExplorer | Level 4
SearchV2Async returning inconsistent results
given the following code:
namespace Dropbox
{
internal class Program
{
static void Main(string[] args)
{
DropboxClientConfig config = new DropboxClientConfig
{
MaxRetriesOnError = 0
};
DropboxClient dropboxClient = new DropboxClient(AccessToken.ValidToken, config);
SearchOptions searchOptions = new SearchOptions("", fileStatus: FileStatus.Active.Instance, filenameOnly: true, fileExtensions: new List<string> { "txt"});
SearchV2Arg searchV2Arg = new SearchV2Arg("test", options: searchOptions);
var result = dropboxClient.Files.SearchV2Async(searchV2Arg).Result;
List<string> filePaths = new List<string>();
foreach (SearchMatchV2 match in result.Matches)
{
filePaths.Add(match.Metadata.AsMetadata.Value.PathLower);
}
}
}
}
if I run it, it shows the following results:
if I change the query value to "this" at line 19 and I run it, I get:
Note, the filePaths list is empty. I would expect the two following file paths to be found (subset from the original 9 above):
"/this is a test.txt"
"/test 2/this is a test.txt"
The Dropbox search backend may apply some tokenization and rewriting to queries, e.g., to try to handle typos, exclude potentially extraneous results, include potentially relevant results, etc. That being the case, you won't always see only exact matches. For instance, for the cases you have shown here, it may remove stop words like "this", and include results for potentially correcting typos or related tokens, such as "text" for "txt".
I'll pass this along as requests to specifically document these behaviors for the API endpoint, as well as the ability to do strict matching searches, but I can't promise if/when these might be done.
- sbrownnwExplorer | Level 4
note, if I remove the fileExtensions filter arg, I still get no results searching for "test":
- sbrownnwExplorer | Level 4
and when I change the query value to "txt", I get the following:
I would expect every file expect the last one "/new rich text format.rtf" to be returned. Why is the .rtf file being returned with this query?
- Greg-DBDropbox Staff
The Dropbox search backend may apply some tokenization and rewriting to queries, e.g., to try to handle typos, exclude potentially extraneous results, include potentially relevant results, etc. That being the case, you won't always see only exact matches. For instance, for the cases you have shown here, it may remove stop words like "this", and include results for potentially correcting typos or related tokens, such as "text" for "txt".
I'll pass this along as requests to specifically document these behaviors for the API endpoint, as well as the ability to do strict matching searches, but I can't promise if/when these might be done.
About Discuss Dropbox Developer & API
Make connections with other developers
795 PostsLatest Activity: 7 days agoIf 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 or Facebook.
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!