Vaporbook/POI-PHP-ONIX-Importer — Issue #1: Create MongoDB Index on RecordReference
Author: paulie4
Created: 2012-02-17 16:29:33+00:00
State: open

Since lib/ONIXMongoStore.php's store() method calls MongoDB's findOne() by RecordReference, there should be an index created for it, otherwise, MongoDB has to do a full scan of every record to search for that RecordReference before any ONIX record can be inserted/updated. The easiest thing would probably be to add a call to $this->collection->ensureIndex('RecordReference') in ONIXMongoStore::__construct().

Two other quick points:

1. It would also be faster to make $oms (the ONIXMongoStore instance) be a global variable in bin/importXML.php, since right now it has to reconnect to MongoDB for every ONIX product.

2. bin/importXML.php is expecting $oms->store() to return a 1 or 2, but store() returns an array.

Thanks,
Paulie