| 1 | = Trac Google Search Plugin = |
| 2 | {{{ |
| 3 | #!rst |
| 4 | TracGoogleSearch_ is a trac_ plugin which enables your trac_ environment to |
| 5 | use Google_'s Adsense_ For Search on the mini search box displayed on top. |
| 6 | |
| 7 | **Note:** Regular trac_ search won't be disabled, the users must click the |
| 8 | *"Search"* button to access it, and will only show up and work if user has |
| 9 | ``SEARCH_VIEW`` permissions, unlike this plugin, which does not |
| 10 | require any special permissions since it's querying Google_ not trac_. |
| 11 | |
| 12 | Installation |
| 13 | ------------ |
| 14 | Installing the plugin is as easy as:: |
| 15 | |
| 16 | sudo easy_install TracGoogleSearch |
| 17 | |
| 18 | And then enabling it: |
| 19 | |
| 20 | .. code-block:: ini |
| 21 | |
| 22 | [components] |
| 23 | tracext.google.search.* = enabled |
| 24 | |
| 25 | And that's it! |
| 26 | |
| 27 | Configuration |
| 28 | ------------- |
| 29 | In order to use this plugin you must first create a custom search engine on |
| 30 | your Adsense_ account, configure it like you want it and choose to display |
| 31 | the results on a page on your own website. |
| 32 | |
| 33 | If you wish Google_ to show results relative to the domain of your trac_ |
| 34 | environment, on your Adsense_ account, edit your search engine settings, choose |
| 35 | *"view more advanced features"*, select *"Search the entire web but emphasize |
| 36 | included sites"* and then under *"Sites"* add your trac_ environment domain. |
| 37 | |
| 38 | From the resulting code that Google_ provides we'll need the values from the |
| 39 | hidden fields named, **cx** and **cof**, ie, your client id and search id |
| 40 | strings. |
| 41 | |
| 42 | Consider the following example code: |
| 43 | |
| 44 | .. code-block:: text/html |
| 45 | |
| 46 | <form action="http://domain.tld/gsearch" id="cse-search-box"> |
| 47 | <div> |
| 48 | <input type="hidden" name="cx" value="partner-pub-0000000000000000:0aaaa0aaa00a" /> |
| 49 | <input type="hidden" name="cof" value="FORID:1" /> |
| 50 | <input type="hidden" name="ie" value="UTF-8" /> |
| 51 | <input type="text" name="q" size="31" /> |
| 52 | <input type="submit" name="sa" value="Search" /> |
| 53 | </div> |
| 54 | </form> |
| 55 | <script type="text/javascript" |
| 56 | src="http://www.google.com/coop/cse/brand?form=cse-search-box&lang=en"></script> |
| 57 | |
| 58 | |
| 59 | The values you'll need to remember would be |
| 60 | **partner-pub-0000000000000000:0aaaa0aaa00a** and **FORID:1**, the rest of the |
| 61 | code will be provided by the plugin. |
| 62 | |
| 63 | The plugin can then be configured on trac_'s administration panel, under the |
| 64 | section **Google** and then **Search**. |
| 65 | |
| 66 | Bugs and/or New Features |
| 67 | ------------------------ |
| 68 | |
| 69 | Please submit bugs of new features to:: |
| 70 | |
| 71 | http://google.ufsoft.org/ |
| 72 | |
| 73 | |
| 74 | Source Code |
| 75 | ----------- |
| 76 | |
| 77 | If you wish to be on the bleeding edge and get the latest available code: |
| 78 | |
| 79 | .. code-block:: sh |
| 80 | |
| 81 | hg clone http://google.ufsoft.org/hg/search/ TracGoogleSearch |
| 82 | |
| 83 | |
| 84 | **Note**: For up-to-date documentation please visit TracGoogleSearch_'s site. |
| 85 | |
| 86 | |
| 87 | .. _trac: http://trac.edgewall.org |
| 88 | .. _TracGoogleSearch: http://google.ufsoft.org/wiki/TracGoogleSearch |
| 89 | .. _Google: http://www.google.com |
| 90 | .. _Adsense: https://www.google.com/adsense/ |
| 91 | }}} |