]> git.evergreen-ils.org Git - Evergreen.git/commit
LP#1947173: Speed up the symspell part of ingest
authorMike Rylander <mrylander@gmail.com>
Thu, 14 Oct 2021 13:57:24 +0000 (09:57 -0400)
committerGalen Charlton <gmc@equinoxOLI.org>
Fri, 5 Nov 2021 16:08:09 +0000 (12:08 -0400)
commit2623d2c0ce8fb6c492b3bb0a4cc4aa45b24c85f8
tree0c302b7b7a1508d17707363c8b3d27e15b33adb3
parent3d05fdf1ef3e5890f16951f074c372327afe3319
LP#1947173: Speed up the symspell part of ingest

For certain data, and certain data set sizes, merging the suggestion
arrays used by the symspell algorithm is noticably expensive.  This is
the case for suggestion arrays containing many thousands of entries.
These suggestion sets are not only slow, but generally not useful.  We
avoid the creation of such overly long suggestion sets using several
word filters that take advantage of our knowledge of the incoming data
to optimize for what is useful in a bibliographic context.  The
mechanisms employed by this patch are:

- Omit suggestions whose length is longer than the max prefix key length
  when the prefix key length is less than or equal to the maximum prefix
  key length minus the maximum edit distance.
- Omit words that contain a run of 5 or more digits. This will drop most
  identifiers from the dictionary while still allowing suggestions to
  happen for year values.
- Omit empty keys from the dictionary.  This should have been the case
  already but is now enforced directly.
- Add a small speedup to evergreen.text_array_merge_unique() by making
  it assume that arrays passed to it do not have null values, which we
  intentionally avoid, and against which we protect in other ways in the
  commit.

Besides improving reingest speed, the patches will also make the
search.symspell_dictionary table significantly smaller.

Signed-off-by: Mike Rylander <mrylander@gmail.com>
Signed-off-by: Galen Charlton <gmc@equinoxOLI.org>
Open-ILS/src/sql/Pg/300.schema.staged_search.sql
Open-ILS/src/sql/Pg/upgrade/XXXX.schema.symspell-speed-ingest.sql [new file with mode: 0644]
Open-ILS/src/support-scripts/symspell-sideload.pl