Teach QueryParser new tricks
authorMike Rylander <mrylander@gmail.com>
Wed, 15 Jan 2014 21:00:52 +0000 (16:00 -0500)
committerMike Rylander <mrylander@gmail.com>
Wed, 22 Jan 2014 14:45:01 +0000 (09:45 -0500)
commitc1a6fb0331a38ef3cd4485ee01e255ca8a60d8d4
tree138fae641a7b04fe2b314aa140a723477f93619f
parent4d8203d3afdd5c170c6fcfc00e48054e39a41fbb
Teach QueryParser new tricks

QP Needs to be made aware of several new structures in the database.

First, we have added a new sort-supporting table called metabib.record_sorter
which holds values extracted by crad.sorter=true attrs.  This is used instead
of the mrd.attrs->"something" hstore composite.

Next, we teach QP how to convert from a list of user-supplied values across
many dynamic filters (based on crad) into an intarray query of ids extracted
from config.coded_value_map (in the case of controlled attributes) or
metabib.uncontrolled_record_attr_value (in the case of, you guessed it,
uncontrolled attributes).  This query is applied against the vlist column
of metabib.record_attr_vector_list, which is GIN indexed for speed.

Finally, metabib.record_attr is now a view over metabib.record_attr_vector_list
and is consequently going to be slow for general use.  We restrict
its inclusion in the core query to only the case of a during() filter
which requires access to the value of a bib's Date2 field.  For the
other common case, requiring access to the Date1 field, we instead
use the pubdate sort value now stored in metabib.record_sorter.  We
might consider making the specific sorter attribute used configurable
so that we can change the definition of pubdate down the road, but it
starts out (and generally stays) defined as equivalent to Date1.

Signed-off-by: Mike Rylander <mrylander@gmail.com>
Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Driver/Pg/QueryParser.pm