[PATCH] Google Suggest for Konqueror Searchbar

Fredy Yanardi fyanardi at gmail.com
Wed May 20 17:12:18 BST 2009


Hi all,

As suggested by Germain, I try to implement a generic search suggestion engine for konqueror searchbar instead of hard coding the suggestion engine only for google.

A little bit explanation on that:
1. I try to make use of existing search providers desktop file by adding one  more entry: [Suggest] that value should refer to suggestion request.
e.g: Suggest=http://www.google.com/complete/search?q=\\{@}&output=toolbar
2. Suggestion request (a KIO::TransferJob) is handled by SearchSuggestion class, that depends on SuggestionEngine (see pt. 3) to parse suggestion reply from the provider.
3. There is a parent class for all suggestion engines, called SuggestionEngine. This suggestion class gets the suggestion request URL from the desktop file mentioned in (1).
4. Actual parsing of suggestion reply is done by subclasses of SuggestionEngine, for the case of Google it is GoogleSuggestEngine class.
5. SearchSuggestion maintains a map of searchprovider name and SuggestionEngine, so if we want to implement a new SuggestionEngine, we can just put the new implementation into the map.

And here are the patches for those changes, one is against konq-plugins/searchbar, and one is against KDE/kdebase/runtime/kurifilter-plugins/ikws.

Any comments will be greatly appreciated.

Thanks,

Fredy Yanardi

On Friday 24 April 2009 Germain Garand <germain at ebooksfrance.org> wrote: 
> Le jeudi 23 avril 2009, Fredy Yanardi a écrit :
> > Hi all,
> >
> > This patch implements a google suggest feature for Konqueroer's
> > Searchbar. It will only send request for suggestion to Google if
> > current search provider is google and the search is not a local
> > search.
> >
> > It is always enabled for google search provider, but I'll work on a
> > context menu entry to disable this feature.
> 
> Hi Fredy,
> 
> you did not attach the files 'GoogleSuggest.cpp' and 'GoogleSuggest.h'...
> 
> Speaking of those, as a general question on the design of your patch, why did 
> you specifically used the names "Google" for REST services that could be 
> provided by many search engines beside this specific one?
> 
> It seems this kind of service is simple to map, so why not abstract that 
> functionality into a generic class, even if it only contains one provider at 
> first?
> 
> For instance, after just a cursory search, I can find at least one other 
> similar REST api:
> 
> http://developer.yahoo.com/search/web/V1/relatedSuggestion.html
> 
> that could be used to extend your work...
> 
> Greetings,
> Germain
>  
-------------- next part --------------
A non-text attachment was scrubbed...
Name: konq_searchbar_google_suggest_2.diff
Type: text/x-patch
Size: 20833 bytes
Desc: not available
URL: <https://mail.kde.org/mailman/private/kfm-devel/attachments/20090521/3d6f3131/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: searchprovider_suggestion.diff
Type: text/x-patch
Size: 850 bytes
Desc: not available
URL: <https://mail.kde.org/mailman/private/kfm-devel/attachments/20090521/3d6f3131/attachment-0001.bin>


More information about the kfm-devel mailing list