|
@@ -2047,31 +2047,32 @@
|
|
|
|
|
|
_searchFileName = fileName;
|
|
|
|
|
|
- if ([[NCManageDatabase sharedInstance] getServerVersion] >= 12 && ![_depth isEqualToString:@"0"]) {
|
|
|
+ // First : filter
|
|
|
|
|
|
- [_timerWaitInput invalidate];
|
|
|
- _timerWaitInput = [NSTimer scheduledTimerWithTimeInterval:1.5 target:self selector:@selector(searchStartTimer) userInfo:nil repeats:NO];
|
|
|
+ NSString *directoryID = [[NCManageDatabase sharedInstance] getDirectoryID:_serverUrl];
|
|
|
+ NSPredicate *predicate = [NSPredicate predicateWithFormat:@"directoryID = %@ AND account = %@ AND fileNamePrint CONTAINS[cd] %@", directoryID, app.activeAccount, fileName];
|
|
|
+ NSArray *records = [[NCManageDatabase sharedInstance] getMetadatasWithPredicate:predicate sorted:nil ascending:NO];
|
|
|
|
|
|
- } else {
|
|
|
+ [_searchResultMetadatas removeAllObjects];
|
|
|
+ for (tableMetadata *record in records)
|
|
|
+ [_searchResultMetadatas addObject:record];
|
|
|
|
|
|
- NSString *directoryID = [[NCManageDatabase sharedInstance] getDirectoryID:_serverUrl];
|
|
|
- NSPredicate *predicate = [NSPredicate predicateWithFormat:@"directoryID = %@ AND account = %@ AND fileNamePrint CONTAINS[cd] %@", directoryID, app.activeAccount, fileName];
|
|
|
- NSArray *records = [[NCManageDatabase sharedInstance] getMetadatasWithPredicate:predicate sorted:nil ascending:NO];
|
|
|
+ CCMetadataNet *metadataNet = [[CCMetadataNet alloc] initWithAccount:app.activeAccount];
|
|
|
|
|
|
- [_searchResultMetadatas removeAllObjects];
|
|
|
- for (tableMetadata *record in records)
|
|
|
- [_searchResultMetadatas addObject:record];
|
|
|
+ metadataNet.account = app.activeAccount;
|
|
|
+ metadataNet.directoryID = directoryID;
|
|
|
+ metadataNet.priority = NSOperationQueuePriorityVeryHigh;
|
|
|
+ metadataNet.selector = selectorSearch;
|
|
|
+ metadataNet.serverUrl = _serverUrl;
|
|
|
+
|
|
|
+ [self readFolderSuccess:metadataNet permissions:@"" etag:@"" metadatas:_searchResultMetadatas];
|
|
|
+
|
|
|
+ // Version >= 12
|
|
|
+ if ([[NCManageDatabase sharedInstance] getServerVersion] >= 12) {
|
|
|
|
|
|
- CCMetadataNet *metadataNet = [[CCMetadataNet alloc] initWithAccount:app.activeAccount];
|
|
|
+ [_timerWaitInput invalidate];
|
|
|
+ _timerWaitInput = [NSTimer scheduledTimerWithTimeInterval:1.5 target:self selector:@selector(searchStartTimer) userInfo:nil repeats:NO];
|
|
|
|
|
|
- metadataNet.account = app.activeAccount;
|
|
|
- metadataNet.action = actionUploadTemplate;
|
|
|
- metadataNet.directoryID = directoryID;
|
|
|
- metadataNet.priority = NSOperationQueuePriorityVeryHigh;
|
|
|
- metadataNet.selector = selectorSearch;
|
|
|
- metadataNet.serverUrl = _serverUrl;
|
|
|
-
|
|
|
- [self readFolderSuccess:metadataNet permissions:@"" etag:@"" metadatas:_searchResultMetadatas];
|
|
|
}
|
|
|
}
|
|
|
|