On Mar 30, 2014, at 22:55, Christiaan Hofman wrote:

> 
> On Mar 30, 2014, at 22:41, Adam R. Maxwell wrote:
> 
>> 
>> On Mar 30, 2014, at 13:38 , Reto Stöckli <[email protected]> wrote:
>> 
>>> The documentation does not mention any limitations on maximum allowed open 
>>> sessions. Sessions timeout by themselves anyway. They just tell you that 
>>> once a session is closed, not retrieved data from previous sessions (e.g. 
>>> marked lists, not important for BibDesk) are lost.
>> 
>> In that case, I'd just add a comment to that effect in the code and forget 
>> about it.
>> 
>> adam
> 
> 
> Probably it still makes sense to close the session when the search group 
> server is cleaned up in serverDidFinish. Probably should then be placed in a 
> @try block.
> 
> Another thing, looking at the code it seems to me that the search is really 
> done twice now, as the first search also gets all the records and not just 
> the number of results. I think trying to read the documentation (which is 
> really not clear on this point) the count in the first try should be 0 to get 
> the total number, rather than 100 (or 1 in the old version). It does seem to 
> work for me, and even gets me more results. (Oh, and use numberWithInteger: 
> rather than the old numberWithInt:). 
> 
> Christiaan


Moreover, is this double search really necessary? It looks like the records can 
be returned already at the first search. In particular, when the search is to 
get more results for the same query (over the initial 100) the first search was 
already done before. So why doesn't this work:

- When availableResults and fetchedResults were both 0 (initial search for new 
search term), try to get the first MAX_RESULTS immediately, and update 
availableResults  and fetchedResults from the returned data.
- When they're not 0 (i.e. get more for the same search) get the next batch of 
MIN(availableResultsLocal - fetchedResultsLocal, MAX_RESULTS), if that's bigger 
than 0.

From the docs it seems that the second case could be done more easily using the 
retrieve operation using the queryID, but in my tests the queryID never seems 
to be returned.

Christiaan

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

Reply via email to