[OPEN-ILS-DEV] Populating newly created facet index

Mike Rylander mrylander at gmail.com
Tue Sep 27 12:35:06 EDT 2011


On Tue, Sep 27, 2011 at 11:32 AM, Elizabeth Longwell <blongwel at eou.edu> wrote:
> I've created a material type keyword facet index and would like to
> populate it as quickly as possible. Can I add entries directly into a
> table such as metabib.real_full_rec based on record id?

Facet data is display-oriented, so the pre-ingested
metabib.real_full_rec is probably not what you want.  I'd suggest
using the oils_xpath_string function against the records directly,
which will be much slower than metabib.real_full_rec but much faster
than a full reindex.  Something like:

  INSERT INTO metabib.facet_entry (source,field,value) SELECT
id,123,oils_xpath_string('//*[@tag="999"]/*[@code="a"]',marc) FROM
biblio.record_entry;

Adjusting the xpath to taste and replacing '123' with the correct id
from config.metabib_field.  Adding an id-range WHERE clause would let
you do it in chunks.  In testing, I get 10k records in about 3
seconds.

> If so, how do I set the index_vector?

There's no index_vector column on metabib.facet_entry, where the facet
data lives.  Nothing to worry about there.

-- 
Mike Rylander
 | Director of Research and Development
 | Equinox Software, Inc. / Your Library's Guide to Open Source
 | phone:  1-877-OPEN-ILS (673-6457)
 | email:  miker at esilibrary.com
 | web:  http://www.esilibrary.com


More information about the Open-ils-dev mailing list