AutoSuggest
Get an autocompleting dialog underneath basic search boxes.
If activated, the dialog appears in both the JavaScript OPAC and the Template
Toolkit OPAC.
Mike Rylander and Bill Erickson largely designed and spec'ed out this
feature, especially at the database level. Lebbeous Fogle-Weekley and
Mike Rylander did the programming.
How it works, for site administrators
-------------------------------------
Once the code is installed, including database stored procedures,
(re)ingesting your bibliographic records will populate two new tables
needed by AutoSuggest: metabib.browse_entry and metabib.browse_entry_def_map.
Yes, for now this means that the size of your database in per-record terms
will be greater. The browse_entry data we generate is extremely similar to
facet data, so it's possible that in the future we can blend them into the
same thing at the database level, and same some space.
To control what gets indexed in the metabib.browse_* tables, set the
boolean 'browse_field' column for each row in config.metabib_field as desired.
Numbers 15 (keyword|keyword) and 16 (subject|complete) should generally be set
to false.
The config.metabib_class table has a new 'bouyant'
column. Setting this to true means that when a user is typing in the OPAC
search box with a search class selector set to, say, 'Subject', and the cmc row
for 'Subject' has 'bouyant' set to true, the top suggestions will definitely
come from the Subject fields of MARC records (if any). 'restrict' is like
'bouyant', only stronger. In that case suggestions /only/ come from the
selected class.
The order of suggestions otherwise has mostly to do with how well what users
have typed matches what's in your bib records, and the value of the weight
column of the relevant config.metabib_field row. Examine the code if you're
curious to know more or want to make adjustments.
The master on/off switch for AutoSuggest is a new row in in config.global_flag
named 'opac.use_autosuggest'. Set its 'enabled' column to true. If you want
your suggestions to be limited to whatever's OPAC visible at the search org,
set the 'value' column to 'opac_visible'.
*WARNING* Turning this on means introducing Dojo in your TPAC. I tried to
keep it minimal, for load time's sake. There's no fieldmapper or IDL stuff in
play.
Managing the little stuff
-------------------------
CSS classes that affect the look of suggestions are in this file for the TPAC:
Open-ILS/web/css/skin/default/opac/style.css
and in this file for the JSPAC:
Open-ILS/web/opac/skin/default/css/layout.css
At bottom, autosuggest is shaped by PostgreSQL's Full Text Search features.
Some of the arguments that are passed to TS_RANK_CD() and TS_HEADLINE() are
expoposed via options to the openils.widget.AutoSuggest and
openils.AutoSuggestStore modules, which have comments. You can customize your
OPAC files to invoke these with your desired options without touching much
actual code.
Signed-off-by: Lebbeous Fogle-Weekley <lebbeous@esilibrary.com>
21 files changed: