dual code when retrieving query set (maxId)

May 31, 2013 at 8:12 PM
I saw your example blog post on returning multiple sets of query results using MaxID and it appears that it's working well. One thing that bothered me a bit though was the fact that the searching code existed in 2 places once above the "Do" loop and again inside it. It looked like the only reason for this was because the query in the loop needed a maxID clause and the second did not. Do you think this could be rectified in one of the following 2 ways:
  1. passing in ulong.MaxValue the first time (no change to library required, not sure if twitter will interpret this correctly though).
  2. changing the parameter type of Search.MaxID to ulong? (allowing nulls, this would probably be useful on SinceID for the same reasons).
Coordinator
Jun 7, 2013 at 5:15 AM
Hi,

You should try it. If your idea works, then blog about it and let me know.

@JoeMayo(https://twitter.com/JoeMayo)
Jun 7, 2013 at 1:26 PM
I see that you found my StackOverflow post as well.

My testing showed the following:

valid SinceID alone: works
valid MaxID alone: works
ulong.MaxValue MaxID alone: works.
valid SinceID and valid MaxID: works
valid SinceID and ulong.MaxValue MaxID: fails.

I think my recommendation would be to change your Search.MaxID and Search.SinceID to a nullable ulong data type, and then you could not include them in the twitter search URL string when they are null. I would attempt this myself if I didn't have a big deadline at the moment that I need to meet.
Coordinator
Jun 9, 2013 at 9:42 PM
That's interesting. Not sure if I can do something like that right now, but will keep it in the back of my mind. I can see where it would be useful to simplify the code.

Thanks for the analysis/feedback.

@JoeMayo