subtleties, one in UI and one in DB
authorLebbeous Fogle-Weekley <lebbeous@esilibrary.com>
Mon, 23 Jan 2012 18:09:47 +0000 (13:09 -0500)
committerLebbeous Fogle-Weekley <lebbeous@esilibrary.com>
Mon, 23 Jan 2012 18:09:47 +0000 (13:09 -0500)
    - take the width attribute of style from the plain HTML input control
        and apply it to the autosuggest dijit
    - oils_tsearch2('keyword'), not 'default'

Signed-off-by: Lebbeous Fogle-Weekley <lebbeous@esilibrary.com>
Open-ILS/src/sql/Pg/030.schema.metabib.sql
Open-ILS/web/opac/skin/default/js/search_bar.js

index 066e687..96e3834 100644 (file)
@@ -143,7 +143,7 @@ CREATE TABLE metabib.browse_entry (
 CREATE INDEX metabib_browse_entry_index_vector_idx ON metabib.browse_entry USING GIST (index_vector);
 CREATE TRIGGER metabib_browse_entry_fti_trigger
     BEFORE INSERT OR UPDATE ON metabib.browse_entry
-    FOR EACH ROW EXECUTE PROCEDURE oils_tsearch2('default');
+    FOR EACH ROW EXECUTE PROCEDURE oils_tsearch2('keyword');
 
 
 CREATE TABLE metabib.browse_entry_def_map (
@@ -483,6 +483,12 @@ BEGIN
         END IF;
 
         IF ind_data.browse_field THEN
+            -- A caveat about this SELECT: this should take care of replacing
+            -- old mbe rows when data changes, but not if normalization (by
+            -- which I mean specifically the output of
+            -- evergreen.oils_tsearch2()) changes.  It may or may not be
+            -- expensive to add a comparison of index_vector to index_vector
+            -- to the WHERE clause below.
             SELECT INTO mbe_row * FROM metabib.browse_entry WHERE value = ind_data.value;
             IF FOUND THEN
                 mbe_id := mbe_row.id;
index 9a86ede..12f827d 100644 (file)
@@ -48,12 +48,6 @@ function updateSearchTypeSelector(id) {
 }
 
 function autoSuggestInit() {
-    /* For the "style" argument to the constructor below, IE 8 hates it if
-     * we supply dojo.attr("search_box", "style") as the value, which worked
-     * nicely in Google Chrome and Firefox.  Filtering the "font" key/value
-     * pair out of that object gets IE not to throw an error, but even then
-     * the result is oddly ugly borders. So for now we're sadly hardcoding
-     * style. */
     var widg = new openils.widget.AutoSuggest(
         {
             "storeArgs": {
@@ -68,7 +62,7 @@ function autoSuggestInit() {
                 if (event.charOrCode == dojo.keys.ENTER)
                     searchBarSubmit();
             },
-            "style": {"width": "260px"},
+            "style": {"width": dojo.attr("search_box", "style").width},
             "value": ((getTerm() != null) ? getTerm() : "")
         }, "search_box"
     );