garaio/xapian_db — Issue #21: Underscores stripped from order_condition
Author: johnmichaelbradley
Created: 2011-11-21 16:31:03+00:00
State: open

First, thanks for the great gem!

Using Rails 3.1.2, Ruby 1.9.2p290 and XapianDb 1.2.2, the problem was discovered when running tests after upgrading my development environment to Rails 3.1.2 and XapianDb 1.2.2. XapianDb.rebuild_xapian_index passed except on classes whose names are camel-cased. This error did NOT occur when I reverted to XapianDb 1.1.2. I am using the ActiveRecord adapter; order_condition seems to work fine. This occurs both with the direct writer and the resque writer.

Here are the error message and the trace from one occurrence:

Mysql2::Error: Unknown column 'academiccalendars.id' in 'order clause': SELECT `academic_calendars`.* FROM `academic_calendars` WHERE `academic_calendars`.`deleted` = 0 ORDER BY academiccalendars.id LIMIT 500 OFFSET 0

from /var/lib/gems/1.9.1/gems/activerecord-3.1.2/lib/active_record/connection_adapters/mysql2_adapter.rb:696:in `query'
from /var/lib/gems/1.9.1/gems/activerecord-3.1.2/lib/active_record/connection_adapters/mysql2_adapter.rb:696:in `block in exec_query'
from /var/lib/gems/1.9.1/gems/activerecord-3.1.2/lib/active_record/connection_adapters/abstract_adapter.rb:244:in `block in log'
from /var/lib/gems/1.9.1/gems/activesupport-3.1.2/lib/active_support/notifications/instrumenter.rb:21:in `instrument'
from /var/lib/gems/1.9.1/gems/activerecord-3.1.2/lib/active_record/connection_adapters/abstract_adapter.rb:239:in `log'
from /var/lib/gems/1.9.1/gems/activerecord-3.1.2/lib/active_record/connection_adapters/mysql2_adapter.rb:694:in `exec_query'
from /var/lib/gems/1.9.1/gems/activerecord-3.1.2/lib/active_record/connection_adapters/mysql2_adapter.rb:688:in `select'
from /var/lib/gems/1.9.1/gems/activerecord-3.1.2/lib/active_record/connection_adapters/abstract/database_statements.rb:18:in `select_all'
from /var/lib/gems/1.9.1/gems/activerecord-3.1.2/lib/active_record/connection_adapters/abstract/query_cache.rb:63:in `select_all'
from /var/lib/gems/1.9.1/gems/activerecord-3.1.2/lib/active_record/base.rb:470:in `find_by_sql'
from /var/lib/gems/1.9.1/gems/activerecord-3.1.2/lib/active_record/relation.rb:111:in `to_a'
from /var/lib/gems/1.9.1/gems/activerecord-3.1.2/lib/active_record/relation.rb:129:in `to_a'
from /var/lib/gems/1.9.1/gems/activerecord-3.1.2/lib/active_record/relation/finder_methods.rb:159:in `all'
from /var/lib/gems/1.9.1/gems/activerecord-3.1.2/lib/active_record/base.rb:441:in `all'
from /var/lib/gems/1.9.1/gems/xapian_db-1.2.2/lib/xapian_db/index_writers/direct_writer.rb:73:in `block in reindex_class'
from /var/lib/gems/1.9.1/gems/xapian_db-1.2.2/lib/xapian_db/index_writers/direct_writer.rb:72:in `times'
from /var/lib/gems/1.9.1/gems/xapian_db-1.2.2/lib/xapian_db/index_writers/direct_writer.rb:72:in `reindex_class'
from /var/lib/gems/1.9.1/gems/xapian_db-1.2.2/lib/xapian_db.rb:160:in `block in rebuild_xapian_index'
from /var/lib/gems/1.9.1/gems/xapian_db-1.2.2/lib/xapian_db.rb:158:in `each'
from /var/lib/gems/1.9.1/gems/xapian_db-1.2.2/lib/xapian_db.rb:158:in `rebuild_xapian_index'