Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Should there be a type for search URLs? #625

Closed
skurfer opened this Issue · 1 comment

2 participants

@skurfer
Owner

I had always kind of assumed there was a type for search URLs, but apparently there isn't. Should we create one?

I can't think of any drawbacks, but there are some benefits.

For one, I see stuff like this all over the code:

NSURL *url = [NSURL URLWithString:[urlString URLEncoding]];
NSString *query = [url absoluteString];
if (query && [query rangeOfString:QUERY_KEY].location != NSNotFound) {
    // treat this like a search URL
}

Wouldn't it be nicer to just say:

if ([[object primaryType] isEqualToString:QSSearchURLType]) {
    // treat this like a search URL
}

And there's the special case of getting indirect objects for the “Find with…” action in the Web Search plug-in. Currently, it gets all QSObjects with QSURLType from the catalog and then does a bunch of processing on them, including the check above. If we could do something like this:

NSArray *searchURLs = [QSLib arrayForType:QSSearchURLType];

Not only would the code be a lot simpler, but (I'm assuming) it would execute much faster.

And finally, the thing that led me to this thinking in the first place: proxy objects. I've added a search URL as a proxy object in the Safari plug-in. It works great in the first pane, but when using "Find With…", it never appears in the third pane. If there were an explicit search URL type, I think I could get the proxy to show in the third pane.

I can make the necessary changes, I just wanted to get opinions first. By adding a simple check to assignURLTypesWithURL, the rest of the application and plug-ins should get the new type “for free”. Then of course I'd have to go update a few places to take advantage of the change.

@pjrobertson
Owner
@skurfer skurfer was assigned
@skurfer skurfer closed this in 8eb5dd5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.