Opened 7 years ago

Closed 7 years ago

#8723 closed (fixed)

Search facility for the new documentation site

Reported by: frasern Owned by: jacob
Component: Documentation Version: master
Severity: Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

The new documentation site (in preview at http://docs.djangoproject.com/) is currently lacking a search facility.

I have created a patch and will attach it shortly.

Attachments (4)

search.diff (9.6 KB) - added by frasern 7 years ago.
search.patch (9.6 KB) - added by frasern 7 years ago.
Same as search.diff, but hopefully Trac will display a .patch file
annotations.xml (1.3 KB) - added by frasern 7 years ago.
context.xml (1.4 KB) - added by frasern 7 years ago.

Download all attachments as: .zip

Change History (7)

Changed 7 years ago by frasern

Changed 7 years ago by frasern

Same as search.diff, but hopefully Trac will display a .patch file

Changed 7 years ago by frasern

Changed 7 years ago by frasern

comment:1 follow-up: Changed 7 years ago by frasern

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

Attached is a patch that adds an embedded Google Custom Search Engine (CSE). Unfortunately Trac doesn't seem to be showing the patch correctly -- please let me know if I need to generate the patch differently to get this to work.

The patch also includes fixes for a couple of issues I noticed in the djangodocs app, specifically:

  1. The regex for the document view was preventing the images and source patterns from ever matching, so I reorderd these. This means the images now show up in the docs (though eventually these should probably be served statically outside Django).


  1. The unpickling of files in views.py was failing in Windows. I had to add 'rb' to the open calls to force the files to be read as binary.

Note that the patch is currently using a CSE key (014182425414053223532:sfhzyefydv8) which I generated on my Google Account. This will work and can be used for testing, but unfortunately it doesn't seem to be possible for me to transfer ownership of this key to someone else. I suspect a core dev will want to generate their own key so that they retain full control over the CSE settings.

I have exported and attached the settings of the CSE I created and the following instructions should allow a core dev to create a new CSE based upon my one:

  1. Go to http://www.google.com/coop/cse/ and click on Create
  2. In the name and description fields, just enter "Temp" for now
  3. In sites to search, just enter "example.com" for now
  4. Ensure the "Do not show ads" checkbox is ticked (as Django is non-profit)
  5. Accept the Ts&Cs and Finish
  6. Go into the new CSE's control panel
  7. Go into the Advanced screen
  8. It will display the unique labels for the new CSE (_cse_XXXXXXXXXXX and _cse_exclude_XXXXXXXXXXX)
  9. Edit the attached context.xml file, replacing my CSE's labels with the new CSE's labels (and also the CustomSearchEngine element's id attribute appropriately) and then upload it.
  10. Edit the attached annotations.xml file, replacing my CSE's labels with the new CSE's labels and then upload it.
  11. Go into the Sites screen and remove "example.com"
  12. Go into the Preview screen
  13. The link to "homepage" contains the unique key for the new CSE. Edit the patch's search_form.html to put in this key.

There is a thread on django-developers discussing this.

comment:2 in reply to: ↑ 1 Changed 7 years ago by ramiro

Replying to frasern:

[...] Unfortunately Trac doesn't seem to be showing the patch correctly -- please let me know if I need to generate the patch differently to get this to work.

No need to worry, the patch parser of this old Trac version has some problems to render some patches to HTML (possible causes are \ No newline at end of file tokens, the size of the patch, the patch has been generated by a tool different from svn diff, ...). But you patch is safe and will be downloaded and reviewed by a triager or core developer.

comment:3 Changed 7 years ago by jacob

  • Resolution set to fixed
  • Status changed from new to closed

Fixed in [8844].

frasern, this is awesome -- thanks so much for the work and really cool clear instructions!

Note: See TracTickets for help on using tickets.
Back to Top