Hi all,
I just noticed something fun. Authlogic updates the User record on every page load because :last_request_at and :perishable_token are updated. Additionally, sunspot will update the record in Solr on every save, even if none of the indexed columns were updated.
As a result, we are re-indexing the logged-in user on every single page load, even though none of the indexed columns have changed.
This patch is the quick fix; we use :ignore_attribute_changes_of to ignore the non-indexed columns (see https://github.com/outoftime/sunspot_rails/wiki/Installation-and-configurati... ). Note that I didn't do this on all models, only User, because this doesn't feel like a particularly elegant solution, and because User is the only one causing problems.
I'd also argue that we might want to drop the last_request_at column unless we have a compelling reason to keep it. perishable_token is only updated when the record is modified, so if we drop last_request_at, we would only have to update the record once at login (in support of last_login_at, etc.), or when the account was genuinely edited.
To verify that things work as intended, you can tail log/sunspot-solr-*.log, or, if you really want to be fancy, snoop on Solr with "sudo tcpdump -vvvXs 1500 -i lo 'port 8982'". 8982 is the port used in development; production mode uses 8983.
-- Matt