1 About the search system
2 =======================
4 The search system in Ganeti Web Manager utilizes three main
7 - `Haystack <http://haystacksearch.org/>`_ - A model-based search
9 - `Whoosh <https://bitbucket.org/mchaput/whoosh/wiki/Home>`_ - A
10 pure-Python indexing and searching library
11 - `jQuery UI Autocomplete
12 widget <http://jqueryui.com/demos/autocomplete/>`_ - Displays
13 suggestions to input boxes as the user types
15 Below, I will discuss the different components of the search system.
20 Haystack is the meat 'n' potatoes of the search system, involved in
21 every aspect. Mainly it does the following:
23 - Defines the search set in terms of GWM models in **/ganeti_web/search_indexes.py**
24 - Manages making queries and indexing the search back-end (currently
26 - Provides search-specific forms and templates (GWM only uses one
27 search result template: **/templates/search/search.html**)
29 Find out more about defining search indexes with the `Haystack
31 API <http://docs.haystacksearch.org/dev/searchindex_api.html>`_. To find
32 out more about Haystack in general, see `its
33 documentation <http://docs.haystacksearch.org/dev/>`_.
38 Whoosh is a pure-Python indexing and searching library that Haystack
39 uses as a search back-end. The developer actually doesn't need to
40 interact with Whoosh directly.
42 Of indexing and DB performance
43 ------------------------------
45 Haystack is currently set to do live indexing. This means that the
46 search index gets updated every time an included model is updated in the
47 database. This means the index will always be up-to-date, but has the
48 potential to severely hamper performance when dealing with a lot of
51 Indexing behavior is set when the search set is defined in **/ganeti_web/search_indexes.py**
52 If database performance starts to become an issue, try using
53 *SearchIndex* instead of *RealTimeSearchIndex*, and run::
55 $ ./manage.py update_index
57 from time-to-time. For more information,
58 please see the `Haystack documentation on the
59 subject <http://docs.haystacksearch.org/dev/searchindex_api.html#keeping-the-index-fresh>`_.
61 jQuery UI Autocomplete widget
62 -----------------------------
64 The Autocomplete widget suggests search results in real-time as the user
65 types a query. This is facilitated through two main components:
67 - `jQuery UI Autocomplete
68 widget <http://jqueryui.com/demos/autocomplete/>`_ itself
69 - An autocomplete Django view **ganeti_web/views/search.py**
70 that supplies Autocomplete with suggestion data to display
72 Basically, the Autocomplete widget calls the autocomplete view as the
73 user types, and fills a pop-up box underneath the input box with search
74 suggestions. The JavaScript logic can be found in **/static/js/autocomplete_search.js**,
75 and the search view can be found in **ganeti_web/views/search.py**.
76 Both of these files contain details about how the suggestion data is
77 structured, sent, and processed.