[Conkeror] [PATCH 2/2] search-engine: provide alternative urls for search engine webjumps

David Kettler kettler at internode.on.net
Sat Feb 7 17:40:29 PST 2009


> This looks good, though I would make one change..
> 
>> +search_engine.prototype.intuit_home_page = function() {
> 
> Change this to an ordinary function called search_engine_get_homepage
> that takes a search engine as its argument.

Ack.

>> +    url = url.replace("//search.", "//");
> 
> What is the purpose of this line?

Here are the (path stripped) urls from the provided search-engines:

% sed -ne '/text\/html/{s,.*template=",,;s,\(.*://[^/]*\)/.*,\1,;p}' *.xml
http://www.answers.com
http://search.creativecommons.org
http://search.ebay.com
http://www.google.com
https://bugzilla.mozilla.org
http://en.wikipedia.org
http://search.yahoo.com

My intention is that the alternative url is normally the home page of 
the site.  Three of those urls have a "search." component in the url 
which, if removed, yields the home page.  That's what the url.replace() 
line is for.

You could argue that visiting a specialised search page is also useful. 
  But it's hard to intuit what that page is on most sites (and most 
sites don't have anything more than a simple search box anyway).
So I think its better for the intuited alternative to be consistently 
the home page.  The user can always specify something else explicitly of 
they prefer.

>> Maybe it would be better to attach the alternative to the webjump
>> object and to have the alternative logic in getWebJump().  Then it
>> need not be in the handlers specified in define_webjump() and
>> define_search_engine_webjump().
> 
> That's a thought.  Let's get these current changes in first.

Ack.

> Thanks, I was looking at writing this feature myself, and now I don't
> have to. :)

No worries.

regards, David.



More information about the Conkeror mailing list