Forum Discussion

CCra's avatar
CCra
Explorer | Level 4
6 years ago
Solved

Documentation for searchV2(String query) how to type a query ?

I have been using older dropboxapiv2 (java) to search "Files" for 2 years. Today it started to malfunction due to a dropbox server side "malformed query" error. While I assume it is again a Dropbox development malfunction, I also would like to upgrade the dropboxapiv2 I am using to version 3.1.3 . It seems there is now a search method searchV2(String query) ,but I could not find any documentation about how to write a search query for dropbox search in api. 

Can anybody help ?

with errors below is my code for, now deprecated, search method

public List<SearchMatch> findFile(String code) {
	try {
		SearchResult sr = dbxClient.files().search("/drawings/",code);
		List<SearchMatch> sm = sr.getMatches();
		List<SearchMatch> rmlist = new ArrayList<SearchMatch>();
		for (SearchMatch searchMatch : sm) {
			if (!fileMidir(searchMatch.getMetadata())) {
				rmlist.add(searchMatch);
			}
		}
		for (SearchMatch searchMatch : rmlist) {
			sm.remove(searchMatch);
		}
		
		return sm;
		
	} catch (DbxException e) {
		e.printStackTrace();
	}
	return null;
}
public boolean fileMidir(Metadata metadata){
	if (metadata instanceof FolderMetadata) {
		return false;
	}else {
		return true;
	}
}

 

  • CCra's avatar
    CCra
    Explorer | Level 4

    BTW, the error is old path name for search "/drawings/" now should be "/drawings". If anybody can help me with searchV2 -how to write a query- (for path specifying and other options), I would appreciate it very much.

About Dropbox API Support & Feedback

Node avatar for Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.5,949 PostsLatest Activity: 3 hours ago
352 Following

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 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!