How to generate the MySQL Workbench documentation library
=========================================================

Make sure you have pysqlite2 with fulltext search enabled. The pysqlite2 builds for WB have that enabled (like the one i nmysql-mac-res)
---------------------------

---------------
To get the manuals, download the following files. One must be on VPN.

  Workbench Manual
    http://oter02.no.oracle.com/docs/workbench/en/html-guitools.zip
    
    * Save as wb-html-guitools.zip to ./repository/source


  Reference Manual
    http://oter02.no.oracle.com/docs/refman-5.5/en/html-guitools.zip

    * Save as refman55-html-guitools.zip to ./repository/source


  Or run ./fetch_documentation.sh

Create SQLite databases
-----------------------

To create the webui database, run

  ./create_webui.sh

This will create the file ./repository/mysqldoclib_webui.sqlite. The file will 
also be copied to /Users/mzinner/Library/Application Support/MySQL/DocLibrary


To create the manual databases, run

  ./create_repository.sh

This will create the files mysqldoclib.sqlite and mysqldoclib_full_55.sqlite in 
the ./repository directory. The files will also be copied 
to /Users/mzinner/Library/Application Support/MySQL/DocLibrary


Test the docs
-------------

To test the docs, run the following command.

  python2.6 ./mysqldoclib.py -p8080 -v serve-docs

Then browse to http://localhost:8080


Use the Full Text Search
------------------------

Note: To work with SQLite database, one can use http://code.google.com/p/sqlite-manager/

To do a full text search execute the following query.

SELECT p.chapter, p.title, wpo.path, pr.rating, m.directory,
    offsets(page_content) as fs_offsets, snippet(page_content) as snippet
FROM page_content pc
  JOIN page p ON p.id_page = pc.id_page
  JOIN manual_version v ON v.id_manual_version = p.id_manual_version
  JOIN manual m ON m.id_manual = v.id_manual
  JOIN web_object wpo ON p.id_web_object = wpo.id_web_object
  LEFT OUTER JOIN page_rating pr ON p.title = pr.title
  LEFT OUTER JOIN page_rating_by_user pru ON p.title = pru.title
WHERE page_content MATCH '"CREATE TABLE"'
ORDER BY pru.rating DESC, substr(fs_offsets, 1, 1), pr.rating DESC
LIMIT 0, 51

