Reduce index bloat involving non-search_field values

Rows in metabib.title_field_entry, subject_field_entry,
series_field_entry, and author_field_entry are doubled or tripled due to
bad logic in biblio.extract_metabib_field_entry. This results in these
tables being 2 or more times their correct size.

This was introduced in 2.2.0 when the logic for browse_field and
facet_field were added to biblio.extract_metabib_field_entry. 2.1 is not
affected.

The duplicates are caused when biblio.extract_metabib_field_entry
returns TRUE in the search_field column for all rows even if they should
just be facet_field or browse_field after the first search_field value
is returned.

Signed-off-by: Mike Rylander <mrylander@gmail.com>
Signed-off-by: Dan Scott <dscott@laurentian.ca>
Bring back "split-brain" indexing normalization

Before 2.4-era changes to indexing and search, normalizers were applied
in a way that resulted in different effects on the value and index_vector
columns of metabib.*field_entry tables.  This behavior was lost during
the changes mentioned above, but we need it for several things to work
properly, phrase search and (likely) facets among them.  This commit
brings that behavior back.

See here for the original behavioral documentation:

http://evergreen-ils.org/dokuwiki/doku.php?id=documentation:indexing#field_normalization_settings

Signed-off-by: Mike Rylander <mrylander@gmail.com>
Signed-off-by: Dan Scott <dscott@laurentian.ca>
Retain index granularity with minimal bloat

The previous approach to reducing index bloat arguably went too far, in
that analytics such as separately catalogued songs for an album were all
simply aggregated together in a single metabib.title_field_entry row,
rather than being added as separated metabib.title_field_entry rows for
each unique value.

To avoid the original problem of exact duplicate rows being inserted, we
now check for an existing matching row before inserting into the index.
A good test record is title "Cello concerto." which results in 1 title
proper row and 4 added entry title rows in metabib.title_field_entry
after this change.

Signed-off-by: Dan Scott <dscott@laurentian.ca>
Create upgrade script for ingest normalization changes

This provides the upgrade script for the ingest changes outlined
in LP 1187433.  In addition, the version-upgrade script for 2.3 to
2.4.0 has been modified to move the final reingest step until after
this incremental change has been applied.

Signed-off-by: Mike Rylander <mrylander@gmail.com>
Signed-off-by: Dan Scott <dscott@laurentian.ca>
Sign off on apostrophe upgrade script

Also had to quote the \qecho commands to prevent them from being
executed instead of simply set to STDOUT.

Signed-off-by: Dan Scott <dscott@laurentian.ca>

Conflicts:
	Open-ILS/src/sql/Pg/002.schema.config.sql