Revision: 29203
          http://sourceforge.net/p/bibdesk/svn/29203
Author:   hofman
Date:     2025-04-26 15:29:41 +0000 (Sat, 26 Apr 2025)
Log Message:
-----------
set record schema from recordSyntax option

Modified Paths:
--------------
    trunk/bibdesk/BDSKSRUGroupServer.m

Modified: trunk/bibdesk/BDSKSRUGroupServer.m
===================================================================
--- trunk/bibdesk/BDSKSRUGroupServer.m  2025-04-26 15:01:56 UTC (rev 29202)
+++ trunk/bibdesk/BDSKSRUGroupServer.m  2025-04-26 15:29:41 UTC (rev 29203)
@@ -101,26 +101,20 @@
     return components;
 }
 
-- (NSURL *)searchURL {
+- (NSURL *)searchURLWithRange:(NSRange)range {
     NSURLComponents *components = [self baseURLComponents];
     NSMutableArray *query = [NSMutableArray array];
     NSString *version = [[[self serverInfo] options] objectForKey:@"version"] 
?: @"1.1";
+    NSString *syntax = [[[self serverInfo] options] 
objectForKey:@"recordSyntax"];
     [query addObject:[@"version=" stringByAppendingString:version]];
     [query addObject:@"operation=searchRetrieve"];
-    [query addObject:[@"query=" stringByAppendingString:[[self searchTerm] 
stringByAddingPercentEscapesForQueryTerm]]];
-    [components setPercentEncodedQuery:[query componentsJoinedByString:@"&"]];
-    return [components URL];
-}
-
-- (NSURL *)fetchURL {
-    NSURLComponents *components = [self baseURLComponents];
-    NSMutableArray *query = [NSMutableArray array];
-    NSString *version = [[[self serverInfo] options] objectForKey:@"version"] 
?: @"1.1";
-    [query addObject:[@"version=" stringByAppendingString:version]];
-    [query addObject:@"operation=searchRetrieve"];
     [query addObject:[@"query=%@" stringByAppendingString:[[self searchTerm] 
stringByAddingPercentEscapesForQueryTerm]]];
-    [query addObject:[NSString stringWithFormat:@"startRecord=%ld", 1 + [self 
numberOfFetchedResults]]];
-    [query addObject:[NSString stringWithFormat:@"maximumRecords=%ld", 
MIN([self numberOfAvailableResults] - [self numberOfFetchedResults], 
MAX_RESULTS)]];
+    if ([syntax length])
+        [query addObject:[@"recordSchema=" stringByAppendingString:syntax]];
+    if (range.length > 0) {
+        [query addObject:[NSString stringWithFormat:@"startRecord=%lu", 1 + 
range.location]];
+        [query addObject:[NSString stringWithFormat:@"maximumRecords=%lu", 
range.length]];
+    }
     [components setPercentEncodedQuery:[query componentsJoinedByString:@"&"]];
     return [components URL];
 }
@@ -182,7 +176,7 @@
     
     if (NO == [NSString isEmptyString:[self searchTerm]]) {
         // get the initial XML document with our search parameters in it
-        NSURL *initialURL = [self searchURL];
+        NSURL *initialURL = [self searchURLWithRange:NSMakeRange(0, 0)];
         BDSKPRECONDITION(initialURL);
         
         downloadState = BDSKSearchState;
@@ -219,7 +213,7 @@
     
     NSRange returnRange = NSMakeRange([self numberOfFetchedResults], MIN([self 
numberOfAvailableResults] - [self numberOfFetchedResults], MAX_RESULTS));
     
-    NSURL *theURL = [self fetchURL];
+    NSURL *theURL = [self searchURLWithRange:returnRange];
     BDSKPOSTCONDITION(theURL);
     
     requestedResults = returnRange.length;

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.



_______________________________________________
Bibdesk-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit

Reply via email to