marinofaggiana 5 жил өмнө
parent
commit
c63b97641c

+ 2 - 0
iOSClient/Library/OCCommunicationLib/OCCommunication.m

@@ -3079,6 +3079,8 @@
 
 - (void)fullTextSearch:(NSString *)serverPath data:(NSString *)data onCommunication:(OCCommunication *)sharedOCComunication successRequest:(void(^)(NSHTTPURLResponse *response, NSArray *items, NSString *redirectedServer))successRequest failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer)) failureRequest {
     
+    serverPath = [serverPath stringByAppendingString:k_url_fulltextsearch];
+    
     OCWebDAVClient *request = [[OCWebDAVClient alloc] init];
     request = [self getRequestWithCredentials:request];
     

+ 2 - 1
iOSClient/Library/OCCommunicationLib/OCWebDavClient/OCWebDAVClient.m

@@ -1297,7 +1297,8 @@ NSString const *OCWebDAVModificationDateKey	= @"modificationdate";
     
     NSMutableURLRequest *request = [self sharedRequestWithMethod:_requestMethod path:serverPath parameters:nil timeout:k_timeout_webdav];
     [request setValue:@"true" forHTTPHeaderField:@"OCS-APIRequest"];
-    [request setHTTPBody:[data dataUsingEncoding:NSUTF8StringEncoding]];
+    //[request setHTTPBody:[data dataUsingEncoding:NSUTF8StringEncoding]];
+    [request setHTTPBody:[[NSString stringWithFormat: @"request=%@",data] dataUsingEncoding:NSUTF8StringEncoding]];
 
     OCHTTPRequestOperation *operation = [self mr_operationWithRequest:request onCommunication:sharedOCCommunication success:success failure:failure];
     [self setRedirectionBlockOnDatataskWithOCCommunication:sharedOCCommunication andSessionManager:sharedOCCommunication.networkSessionManager];

+ 8 - 5
iOSClient/Main/CCMain.m

@@ -1316,11 +1316,14 @@
        
         if (errorCode == 0 && [account isEqualToString:appDelegate.activeAccount]) {
             
-            /*
-            [[OCNetworking sharedManager] fullTextSearchWithAccount:appDelegate.activeAccount text:_searchFileName page:1 completion:^(NSString *account, NSArray *items, NSString *message, NSInteger errorCode) {
-                NSLog(@"x");
-            }];
-            */
+#if TARGET_OS_SIMULATOR
+            tableCapabilities *capabilities = [[NCManageDatabase sharedInstance] getCapabilitesWithAccount:account];
+            if (capabilities.isFulltextsearchEnabled) {
+                [[OCNetworking sharedManager] fullTextSearchWithAccount:appDelegate.activeAccount text:_searchFileName page:1 completion:^(NSString *account, NSArray *items, NSString *message, NSInteger errorCode) {
+                    NSLog(@"x");
+                }];
+            }
+#endif
             
             _searchResultMetadatas = [[NSMutableArray alloc] initWithArray:metadatas];
             [self insertMetadatasWithAccount:appDelegate.activeAccount serverUrl:_serverUrl metadataFolder:nil metadatas:_searchResultMetadatas];

+ 8 - 0
iOSClient/Networking/OCNetworking.m

@@ -2352,6 +2352,14 @@
     [dataDic setValue:text forKey:@"search"];
     [dataDic setValue:[NSNumber numberWithInteger:page] forKey:@"page"];
     [dataDic setValue:[NSNumber numberWithInt:20] forKey:@"size"];
+    
+    NSMutableDictionary *options = [NSMutableDictionary new];
+    [options setValue:@"" forKey:@"files_within_dir"];
+    [options setValue:@"" forKey:@"files_local"];
+    [options setValue:@"" forKey:@"files_extension"];
+    
+    [dataDic setValue:options forKey:@"options"];
+    
     NSString *data = [[NSString alloc] initWithData:[NSJSONSerialization dataWithJSONObject:dataDic options:0 error:nil] encoding:NSUTF8StringEncoding];
     
     OCCommunication *communication = [OCNetworking sharedManager].sharedOCCommunication;