Acq: improve General Search's ability to find invoices
authorLebbeous Fogle-Weekley <lebbeous@esilibrary.com>
Tue, 14 Feb 2012 22:49:54 +0000 (17:49 -0500)
committerMike Rylander <mrylander@gmail.com>
Fri, 23 Mar 2012 20:20:30 +0000 (16:20 -0400)
commit3149433d354889fba7d7a2338acb55d7d1ffa219
treefd305faa1a1aa6728174c9417eaedc123df45aa1
parent73a6d114b56af44b8af40b28d9406d527e6f94f6
Acq: improve General Search's ability to find invoices

Invoices in Evergreen have complex relationships with other items.  They
can be related to lineitems (and ultimately POs and selection lists) by
invoice *entries*, or to PO items (and ultimately etc etc) by invoice
*items*, or directly to purchase orders by either of the above mentioned
acq.invoice_{entry,item} objects.

This should make general search more able to find invoices related to
other objects whose fields you might search against in Acquistions
General search.

Here's a diagram that I created to help me think about how to write
these joins:

https://docs.google.com/drawings/d/15ExkiYvq0skfobbocvPWxwdZkb7aykEZpLGfbP9PL04/edit

At Bill Erickson's suggestion, I wound up putting the joins into an IDL view
("acqus") rather than trying to express them in JSON query, which was turning
into a real time sink.

To prevent this change from making Acq General Search slower than it
was, I've also added indices on all the foreign keys used in the IDL
view, so that the joins should be as fast as possible.

Signed-off-by: Lebbeous Fogle-Weekley <lebbeous@esilibrary.com>
Signed-off-by: Bill Erickson <berick@esilibrary.com>
Signed-off-by: Mike Rylander <mrylander@gmail.com>
Open-ILS/examples/fm_IDL.xml
Open-ILS/src/perlmods/lib/OpenILS/Application/Acq/Search.pm
Open-ILS/src/sql/Pg/200.schema.acq.sql
Open-ILS/src/sql/Pg/upgrade/XXXX.schema.acq_fk_indices.sql [new file with mode: 0644]