Need to see if your shared folder is taking up space on your dropbox 👨💻? Find out how to check here.
Forum Discussion
sbrownnw
3 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.
5 Replies
Replies have been turned off for this discussion
- sbrownnw3 years agoExplorer | Level 4
note, if I remove the fileExtensions filter arg, I still get no results searching for "test":
- sbrownnw3 years agoExplorer | 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-DB3 years ago
Dropbox Community Moderator
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.
- sbrownnw3 years agoExplorer | Level 4
a list of the stop words would be appreciated also.
- Greg-DB3 years ago
Dropbox Community Moderator
Thanks for the note, I'll add that to the request as well.
About 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!