Giter Club home page Giter Club logo

acts_as_indexed's People

Contributors

banderso avatar bob-p avatar dependabot[bot] avatar dougal avatar gabynaiman avatar gudata avatar ionas avatar myabc avatar nilbus avatar parndt avatar phurni avatar ryankopf avatar ugisozols avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

acts_as_indexed's Issues

Rails 4 Deprecation Warnings

Deprecation warnings with Rails 4.0.8 and ActiveRecord 4.0.8 when using find_with_index.

This code:
my_search_results = Post.find_with_index('my search query')

will cause the following deprecation warnings:

DEPRECATION WARNING: ActiveRecord::Base#with_scope and #with_exclusive_scope are deprecated. Please use ActiveRecord::Relation#scoping instead. (You can use #merge to merge multiple scopes together.)

DEPRECATION WARNING: Calling #find(:all) is deprecated. Please call #all directly instead. You have also used finder options. These are also deprecated. Please build a scope instead of using finder options

DEPRECATION WARNING: Relation#all is deprecated. If you want to eager-load a relation, you can call #load (e.g. Post.where(published: true).load). If you want to get an array of records from a relation, you can call #to_a (e.g. Post.where(published: true).to_a)

How does it work with just a few characters in search string?

I use in my app:

  • Rails 4.2.6
  • Postgresql
  • acts_as_indexed (0.8.3) with initializer
ActsAsIndexed.configure do |config|
  config.min_word_size = 1
end

implemented to model Product.rb by

acts_as_indexed fields: [:name]

Assuming the follwoing product name "Uniwersalna pokrywka Stoneline"

The following expression will find the record:

Product.with_query('Uniwe')

Below expression will NOT find anything. Just one character less though.

Product.with_query('Uniw')

why?

STI support

Any plans on integrating STI support?

Currently, I have to define my indexed fields in each subclass. Defining the indexed fields in the base class results in undefined behavior during initial index construction (on the fly updates seam to work though...).

Not a big problem in my case, as I am not searching in the base class anyway, but in other cases this might be desirable.

README ... Heroku

The docs say that acts_as_indexed "supports Heroku." This is misleading and should be clarified.

https://devcenter.heroku.com/articles/read-only-filesystem

According to the Heroku, a file written to tmp is guaranteed no longer than the duration of a single request. In practice perhaps files live much longer; however, this should be explained. Also, it might be so that acts_as_indexed will try to rebuild indexes automatically, but my experience is, it will eventually fail, and there is no obvious way to manually repair it.

I should add that acts_as_indexed is pure awesome in terms of ease of use an intuitive and powerful design. However, in my opinion it's a bad choice on Heroku, event as a "starter" solution. Sucks that Heroku does not provide some limited durable file storage as part of the base plan.

IOError

When I add acts_as_indexed to my model with some fields I'm getting the following error, whenever I try to create new records within that model...

The process cannot access the file because another process has locked a portion of the file

app/controllers/reviews_controller.rb:52:in `create'
app/controllers/reviews_controller.rb:51:in `create'

Here are those lines...

def create
    @review = review.new(params[:review])

    respond_to do |format|
      if @review.save
      # some stuff
      end
    end
end

Force reindex or flush index commands?

Is it possible to clear all the index data to reindex files, or somehow to force reindexing?
The problem, why I need this, is described here: refinery/refinerycms-search#64 (comment)
If i just perform Model.all(&:save), it is looks like index is not updated for already indexed records (it is strange, but probably there is some mechanism which is checking if the data was actually updated, while I need to reindex all files without actually updating the data, but updating its encoding (.to_ascii))

Will Paginate integration broken

I think that the Will Paginate internals have changed sufficiently to break the paginate_search integration:

@items = Library::Item.paginate_search(params[:query], page: params[:page])
undefined method `wp_parse_options' for #<Class:0x00000007b8f040>
activerecord (3.1.3) lib/active_record/base.rb:1088:in `method_missing'
acts_as_indexed (0.7.7) lib/will_paginate_search.rb:12:in `paginate_search'
app/controllers/libraries_controller.rb:10:in `search'

I can't find wp_parse_options in the codebase at all now and the way of fetching those options seems radically different now. I haven't had time to investigate further.

Gemfile.lock:

will_paginate (3.0.2)
acts_as_indexed (0.7.7)

I also found I had to explicitly require the will_paginate_search file, which isn't mentioned in the documentation.

Exposing build_index

I am working on a Rails app where I am creating/updating thousands of records in a bunch. Indexing time got very large very quick. Would there be a performance gain to disabling auto-indexing and then calling build_index on the model when my bulk changes are done? If so, should build_index be exposed?

Errno::ENOENT No such (No such file or directory ...)

We are using refinery and having similar issues lately when creating objects. Our collected_activityitem model has: acts_as_indexed [:name]
We used acts_as_indexed 0.7.8 then switched to 0.8.3 hoping that it will solve this problem but not. I'm not totally sure that the problem is with acts_as_indexed but it seems to me.

What can be the problem?

Thanks, David

Stack on error:

Errno::ENOENT (No such file or directory - /home/toplamax/toplamax_web/tmp/index/production/refinery/collected_activityitems/collected_activityitem/117_51_48.ind.tmp or /home/toplamax/toplamax_web/tmp/index/production/refinery/collected_activityitems/collected_activityitem/117_51_48.ind):
backports (3.3.0) lib/backports/tools.rb:143:in rename_without_potential_path_argument' backports (3.3.0) lib/backports/tools.rb:143:inrename'
/usr/lib/ruby/1.8/fileutils.rb:506:in mv' /usr/lib/ruby/1.8/fileutils.rb:1397:infu_each_src_dest'
/usr/lib/ruby/1.8/fileutils.rb:1413:in fu_each_src_dest0' /usr/lib/ruby/1.8/fileutils.rb:1395:infu_each_src_dest'
/usr/lib/ruby/1.8/fileutils.rb:495:in mv' acts_as_indexed (0.8.3) lib/acts_as_indexed/storage.rb:167:inwrite_file'
acts_as_indexed (0.8.3) lib/acts_as_indexed/storage.rb:93:in operate' acts_as_indexed (0.8.3) lib/acts_as_indexed/storage.rb:182:inlock_file'
backports (3.3.0) lib/backports/tools.rb:143:in open_without_potential_path_argument' backports (3.3.0) lib/backports/tools.rb:143:inopen'
/usr/lib/ruby/1.8/pathname.rb:812:in open' acts_as_indexed (0.8.3) lib/acts_as_indexed/storage.rb:179:inlock_file'
acts_as_indexed (0.8.3) lib/acts_as_indexed/storage.rb:175:in synchronize' acts_as_indexed (0.8.3) lib/acts_as_indexed/storage.rb:175:inlock_file'
acts_as_indexed (0.8.3) lib/acts_as_indexed/storage.rb:81:in operate' activesupport (3.2.7) lib/active_support/ordered_hash.rb:162:ineach'
activesupport (3.2.7) lib/active_support/ordered_hash.rb:162:in each' acts_as_indexed (0.8.3) lib/acts_as_indexed/storage.rb:78:inoperate'
acts_as_indexed (0.8.3) lib/acts_as_indexed/storage.rb:21:in add' acts_as_indexed (0.8.3) lib/acts_as_indexed/search_index.rb:23:inadd_record'
acts_as_indexed (0.8.3) lib/acts_as_indexed/class_methods.rb:59:in index_add' acts_as_indexed (0.8.3) lib/acts_as_indexed/instance_methods.rb:11:inadd_to_index'
activesupport (3.2.7) lib/active_support/callbacks.rb:405:in _run__1452809277__create__4__callbacks' activesupport (3.2.7) lib/active_support/callbacks.rb:405:insend'
activesupport (3.2.7) lib/active_support/callbacks.rb:405:in __run_callback' activesupport (3.2.7) lib/active_support/callbacks.rb:385:in_run_create_callbacks'
activesupport (3.2.7) lib/active_support/callbacks.rb:81:in send' activesupport (3.2.7) lib/active_support/callbacks.rb:81:inrun_callbacks'
activerecord (3.2.7) lib/active_record/callbacks.rb:268:in create' activerecord (3.2.7) lib/active_record/persistence.rb:348:increate_or_update'
activerecord (3.2.7) lib/active_record/callbacks.rb:264:in create_or_update' activesupport (3.2.7) lib/active_support/callbacks.rb:436:in_run__1452809277__save__4__callbacks'
activesupport (3.2.7) lib/active_support/callbacks.rb:405:in send' activesupport (3.2.7) lib/active_support/callbacks.rb:405:in__run_callback'
activesupport (3.2.7) lib/active_support/callbacks.rb:385:in _run_save_callbacks' activesupport (3.2.7) lib/active_support/callbacks.rb:81:insend'
activesupport (3.2.7) lib/active_support/callbacks.rb:81:in run_callbacks' activerecord (3.2.7) lib/active_record/callbacks.rb:264:increate_or_update'
activerecord (3.2.7) lib/active_record/persistence.rb:84:in save' activerecord (3.2.7) lib/active_record/validations.rb:50:insave'
activerecord (3.2.7) lib/active_record/attribute_methods/dirty.rb:22:in save' activerecord (3.2.7) lib/active_record/transactions.rb:241:insave'
activerecord (3.2.7) lib/active_record/transactions.rb:295:in with_transaction_returning_status' activerecord (3.2.7) lib/active_record/connection_adapters/abstract/database_statements.rb:192:intransaction'
activerecord (3.2.7) lib/active_record/transactions.rb:208:in transaction_without_trace_ActiveRecord_self_name_transaction' newrelic_rpm (3.6.3.104) lib/new_relic/agent/method_tracer.rb:523:intransaction'
newrelic_rpm (3.6.3.104) lib/new_relic/agent/method_tracer.rb:273:in trace_execution_scoped' newrelic_rpm (3.6.3.104) lib/new_relic/agent/method_tracer.rb:518:intransaction'
activerecord (3.2.7) lib/active_record/transactions.rb:293:in with_transaction_returning_status' activerecord (3.2.7) lib/active_record/transactions.rb:241:insave'
activerecord (3.2.7) lib/active_record/transactions.rb:252:in rollback_active_record_state!' activerecord (3.2.7) lib/active_record/transactions.rb:240:insave'
activerecord (3.2.7) lib/active_record/persistence.rb:45:in create' vendor/extensions/collected_activityitems/app/models/refinery/collected_activityitems/collected_activityitem.rb:130:increate_record'
vendor/extensions/synchronizations/app/controllers/refinery/synchronizations/synchronizations_controller.rb:562:in create_record' actionpack (3.2.7) lib/action_controller/metal/implicit_render.rb:4:insend_action'
actionpack (3.2.7) lib/action_controller/metal/implicit_render.rb:4:in send_action' actionpack (3.2.7) lib/abstract_controller/base.rb:167:inprocess_action'
actionpack (3.2.7) lib/action_controller/metal/rendering.rb:10:in process_action' actionpack (3.2.7) lib/abstract_controller/callbacks.rb:18:inprocess_action'
activesupport (3.2.7) lib/active_support/callbacks.rb:447:in _run__378300131__process_action__209150944__callbacks' activesupport (3.2.7) lib/active_support/callbacks.rb:405:insend'
activesupport (3.2.7) lib/active_support/callbacks.rb:405:in __run_callback' activesupport (3.2.7) lib/active_support/callbacks.rb:385:in_run_process_action_callbacks'
activesupport (3.2.7) lib/active_support/callbacks.rb:81:in send' activesupport (3.2.7) lib/active_support/callbacks.rb:81:inrun_callbacks'
actionpack (3.2.7) lib/abstract_controller/callbacks.rb:17:in process_action' actionpack (3.2.7) lib/action_controller/metal/instrumentation.rb:30:inprocess_action'
activesupport (3.2.7) lib/active_support/notifications.rb:123:in instrument' activesupport (3.2.7) lib/active_support/notifications/instrumenter.rb:20:ininstrument'
activesupport (3.2.7) lib/active_support/notifications.rb:123:in instrument' actionpack (3.2.7) lib/action_controller/metal/instrumentation.rb:29:inprocess_action'
actionpack (3.2.7) lib/action_controller/metal/params_wrapper.rb:207:in process_action' activerecord (3.2.7) lib/active_record/railties/controller_runtime.rb:18:inprocess_action'
newrelic_rpm (3.6.3.104) lib/new_relic/agent/instrumentation/rails3/action_controller.rb:38:in process_action' newrelic_rpm (3.6.3.104) lib/new_relic/agent/instrumentation/controller_instrumentation.rb:318:inperform_action_with_newrelic_trace'
newrelic_rpm (3.6.3.104) lib/new_relic/agent/instrumentation/rails3/action_controller.rb:37:in process_action' actionpack (3.2.7) lib/abstract_controller/base.rb:121:inprocess'
actionpack (3.2.7) lib/abstract_controller/rendering.rb:45:in process' actionpack (3.2.7) lib/action_controller/metal.rb:203:indispatch'
actionpack (3.2.7) lib/action_controller/metal/rack_delegation.rb:14:in dispatch' actionpack (3.2.7) lib/action_controller/metal.rb:246:inaction'
actionpack (3.2.7) lib/action_dispatch/routing/route_set.rb:73:in call' actionpack (3.2.7) lib/action_dispatch/routing/route_set.rb:73:indispatch'
actionpack (3.2.7) lib/action_dispatch/routing/route_set.rb:36:in call' actionpack (3.2.7) lib/action_dispatch/routing/mapper.rb:42:incall'
journey (1.0.4) lib/journey/router.rb:68:in call' journey (1.0.4) lib/journey/router.rb:56:ineach'
journey (1.0.4) lib/journey/router.rb:56:in call' actionpack (3.2.7) lib/action_dispatch/routing/route_set.rb:600:incall'
railties (3.2.7) lib/rails/engine.rb:479:in call' railties (3.2.7) lib/rails/railtie/configurable.rb:30:insend'
railties (3.2.7) lib/rails/railtie/configurable.rb:30:in method_missing' journey (1.0.4) lib/journey/router.rb:68:incall'
journey (1.0.4) lib/journey/router.rb:56:in each' journey (1.0.4) lib/journey/router.rb:56:incall'
actionpack (3.2.7) lib/action_dispatch/routing/route_set.rb:600:in call' newrelic_rpm (3.6.3.104) lib/new_relic/rack/error_collector.rb:12:incall'
newrelic_rpm (3.6.3.104) lib/new_relic/rack/agent_hooks.rb:22:in call' newrelic_rpm (3.6.3.104) lib/new_relic/rack/browser_monitoring.rb:16:incall'
warden (1.2.1) lib/warden/manager.rb:35:in call' warden (1.2.1) lib/warden/manager.rb:34:incatch'
warden (1.2.1) lib/warden/manager.rb:34:in `call'
.....

If a record doesn't qualify to be included in the index on create, it may not be added even if a later update makes it qualify

Consider the following model:

class Category < ActiveRecord::Base
  acts_as_indexed :fields => [:name, :description], :if => Proc.new { |c| c.products.count > 0 }
  has_many :products
end

If you create a new category that doesn't have any products assigned to it, it won't be included in the index because the :if proc isn't satisfied. If you then later add a product to it and force/trigger the update_index method (changing no other indexed field), it won't be added to the index. This is because ActsAsIndexed::SearchIndex::record_unchanged? will always return true in this case, because when the proc is evaluated on old_record it sees that c.products.count > 0 and the same happens with the proc is evaluated on the old_record - i.e. it is basing the old and new state on the same virtual attribute which isn't ever going to be dirty.

Searching keyword in czech language

Hi,
is it possible to use czech language for searching?

If I tried to search some word, it gave me strange results.

Words like "lázně", "duše" or "bíčí" are not found
but words like "okvětů", "hodně","křížala" and "očividně" yes

Both contains czech diacritic and some are found and some not.

Where is the problem? Can you help me?
Thanks.

Russian text search

Sorry to disturb, but every time i pull a cyrillic(russian) string into search box
i recieve an empty result. Is it ok? how could i walk it around?

Using "_" in query

The search doesn't work with "_" .
For example in text "Test_try_it" when I search for try or try , don't return result.

Fuzzy matches

It seems that this plugin only supports exact word matches? Is there any support for matching parts of words or even "fuzzy" matches?

Issue with db:migrate & acts_as_indexed files

We're creating a development environment deployment that utilizes Refinery CMS (which, in turn, uses acts_as_indexed). Deployment is happening using vagrant & VirtualBox. Everything seems to go well when we deploy on Mac OS X, but we're seeing an issue during deployment on Windows. During the execution of db:migrate on the Ubuntu VM, deployment fails because a file cannot be renamed (moved) on the mount to the Windows share that holds the git checkout for the project.

Full stacktrace is below, but the relevant bit:Operation not permitted - (/srv/enmasse-online/current/index/development/ RefinerySetting/100_114_97.ind.tmp, /srv/enmasse-online/current/index/ development/RefinerySetting/100_114_97.ind)

When I run the mv outside of rake on the Ubuntu VM (mv 100_114_97.ind.tmp 100_114_97.ind), the file is moved properly. I made the directory on the Windows box world writable and the issue was not resolved.

What is act_as_indexed trying to do during the db:migrate that would work on a unix-based system but encounter issues on a unix-based system trying to move a file on a Windows mount?

Reference: http://groups.google.com/group/refinery-cms/browse_thread/thread/3f19f1c7ae5bbeee

Stack trace & manual move of the file below:

vagrant@lucid64:/srv/enmasse-online/current$ bundle exec rake db:migrate --trace
** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
rake aborted!
Operation not permitted - (/srv/enmasse-online/current/index/development/RefinerySetting/100_114_97.ind.tmp, /srv/enmasse-online/current/index/development/RefinerySetting/100_114_97.ind)
/usr/local/rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/fileutils.rb:515:in rename' /usr/local/rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/fileutils.rb:515:inblock in mv'
/usr/local/rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/fileutils.rb:1423:in block in fu_each_src_dest' /usr/local/rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/fileutils.rb:1439:infu_each_src_dest0'
/usr/local/rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/fileutils.rb:1421:in fu_each_src_dest' /usr/local/rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/fileutils.rb:504:inmv'
/usr/local/rvm/gems/ruby-1.9.2-p180@enmasse_online/gems/acts_as_indexed-0.7.2/lib/acts_as_indexed/storage.rb:164:in write_file' /usr/local/rvm/gems/ruby-1.9.2-p180@enmasse_online/gems/acts_as_indexed-0.7.2/lib/acts_as_indexed/storage.rb:95:inblock (2 levels) in operate'
/usr/local/rvm/gems/ruby-1.9.2-p180@enmasse_online/gems/acts_as_indexed-0.7.2/lib/acts_as_indexed/storage.rb:175:in block in lock_file' /usr/local/rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/pathname.rb:829:inopen'
/usr/local/rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/pathname.rb:829:in open' /usr/local/rvm/gems/ruby-1.9.2-p180@enmasse_online/gems/acts_as_indexed-0.7.2/lib/acts_as_indexed/storage.rb:172:inlock_file'
/usr/local/rvm/gems/ruby-1.9.2-p180@enmasse_online/gems/acts_as_indexed-0.7.2/lib/acts_as_indexed/storage.rb:83:in block in operate' /usr/local/rvm/gems/ruby-1.9.2-p180@enmasse_online/gems/acts_as_indexed-0.7.2/lib/acts_as_indexed/storage.rb:80:ineach'
/usr/local/rvm/gems/ruby-1.9.2-p180@enmasse_online/gems/acts_as_indexed-0.7.2/lib/acts_as_indexed/storage.rb:80:in operate' /usr/local/rvm/gems/ruby-1.9.2-p180@enmasse_online/gems/acts_as_indexed-0.7.2/lib/acts_as_indexed/storage.rb:23:inadd'
/usr/local/rvm/gems/ruby-1.9.2-p180@enmasse_online/gems/acts_as_indexed-0.7.2/lib/acts_as_indexed/search_index.rb:28:in add_record' /usr/local/rvm/gems/ruby-1.9.2-p180@enmasse_online/gems/acts_as_indexed-0.7.2/lib/acts_as_indexed/class_methods.rb:65:inindex_add'
/usr/local/rvm/gems/ruby-1.9.2-p180@enmasse_online/gems/acts_as_indexed-0.7.2/lib/acts_as_indexed/instance_methods.rb:16:in add_to_index' /usr/local/rvm/gems/ruby-1.9.2-p180@enmasse_online/gems/activesupport-3.0.9/lib/active_support/callbacks.rb:416:in_run_create_callbacks'
/usr/local/rvm/gems/ruby-1.9.2-p180@enmasse_online/gems/activerecord-3.0.9/lib/active_record/callbacks.rb:277:in create' /usr/local/rvm/gems/ruby-1.9.2-p180@enmasse_online/gems/activerecord-3.0.9/lib/active_record/persistence.rb:250:increate_or_update'
/usr/local/rvm/gems/ruby-1.9.2-p180@enmasse_online/gems/activerecord-3.0.9/lib/active_record/callbacks.rb:273:in block in create_or_update' /usr/local/rvm/gems/ruby-1.9.2-p180@enmasse_online/gems/activesupport-3.0.9/lib/active_support/callbacks.rb:419:in_run_save_callbacks'
/usr/local/rvm/gems/ruby-1.9.2-p180@enmasse_online/gems/activerecord-3.0.9/lib/active_record/callbacks.rb:273:in create_or_update' /usr/local/rvm/gems/ruby-1.9.2-p180@enmasse_online/gems/activerecord-3.0.9/lib/active_record/persistence.rb:40:insave'
/usr/local/rvm/gems/ruby-1.9.2-p180@enmasse_online/gems/activerecord-3.0.9/lib/active_record/validations.rb:43:in save' /usr/local/rvm/gems/ruby-1.9.2-p180@enmasse_online/gems/activerecord-3.0.9/lib/active_record/attribute_methods/dirty.rb:21:insave'
/usr/local/rvm/gems/ruby-1.9.2-p180@enmasse_online/gems/activerecord-3.0.9/lib/active_record/transactions.rb:240:in block (2 levels) in save' /usr/local/rvm/gems/ruby-1.9.2-p180@enmasse_online/gems/activerecord-3.0.9/lib/active_record/transactions.rb:292:inblock in with_transaction_returning_status'
/usr/local/rvm/gems/ruby-1.9.2-p180@enmasse_online/gems/activerecord-3.0.9/lib/active_record/connection_adapters/abstract/database_statements.rb:139:in transaction' /usr/local/rvm/gems/ruby-1.9.2-p180@enmasse_online/gems/activerecord-3.0.9/lib/active_record/transactions.rb:207:intransaction'
/usr/local/rvm/gems/ruby-1.9.2-p180@enmasse_online/gems/activerecord-3.0.9/lib/active_record/transactions.rb:290:in with_transaction_returning_status' /usr/local/rvm/gems/ruby-1.9.2-p180@enmasse_online/gems/activerecord-3.0.9/lib/active_record/transactions.rb:240:inblock in save'
/usr/local/rvm/gems/ruby-1.9.2-p180@enmasse_online/gems/activerecord-3.0.9/lib/active_record/transactions.rb:251:in rollback_active_record_state!' /usr/local/rvm/gems/ruby-1.9.2-p180@enmasse_online/gems/activerecord-3.0.9/lib/active_record/transactions.rb:239:insave'
/usr/local/rvm/gems/ruby-1.9.2-p180@enmasse_online/gems/refinerycms-settings-0.9.9.22/app/models/refinery_setting.rb:133:in set' /usr/local/rvm/gems/ruby-1.9.2-p180@enmasse_online/gems/refinerycms-settings-0.9.9.22/app/models/refinery_setting.rb:98:infind_or_set'
/srv/enmasse-online/current/vendor/engines/refinerycms-images/lib/refinerycms-images.rb:35:in block (2 levels) in <class:Engine>' /usr/local/rvm/gems/ruby-1.9.2-p180@enmasse_online/gems/dragonfly-0.9.4/lib/dragonfly/configurable.rb:35:inconfigure'
/usr/local/rvm/gems/ruby-1.9.2-p180@enmasse_online/gems/dragonfly-0.9.4/lib/dragonfly/configurable.rb:42:in configure_with' /srv/enmasse-online/current/vendor/engines/refinerycms-images/lib/refinerycms-images.rb:26:inblock in class:Engine'
/usr/local/rvm/gems/ruby-1.9.2-p180@enmasse_online/gems/railties-3.0.9/lib/rails/initializable.rb:25:in instance_exec' /usr/local/rvm/gems/ruby-1.9.2-p180@enmasse_online/gems/railties-3.0.9/lib/rails/initializable.rb:25:inrun'
/usr/local/rvm/gems/ruby-1.9.2-p180@enmasse_online/gems/railties-3.0.9/lib/rails/initializable.rb:50:in block in run_initializers' /usr/local/rvm/gems/ruby-1.9.2-p180@enmasse_online/gems/railties-3.0.9/lib/rails/initializable.rb:49:ineach'
/usr/local/rvm/gems/ruby-1.9.2-p180@enmasse_online/gems/railties-3.0.9/lib/rails/initializable.rb:49:in run_initializers' /usr/local/rvm/gems/ruby-1.9.2-p180@enmasse_online/gems/railties-3.0.9/lib/rails/application.rb:134:ininitialize!'
/usr/local/rvm/gems/ruby-1.9.2-p180@enmasse_online/gems/railties-3.0.9/lib/rails/application.rb:77:in method_missing' /srv/enmasse-online/current/config/environment.rb:13:in<top (required)>'
/usr/local/rvm/gems/ruby-1.9.2-p180@enmasse_online/gems/activesupport-3.0.9/lib/active_support/dependencies.rb:239:in require' /usr/local/rvm/gems/ruby-1.9.2-p180@enmasse_online/gems/activesupport-3.0.9/lib/active_support/dependencies.rb:239:inblock in require'
/usr/local/rvm/gems/ruby-1.9.2-p180@enmasse_online/gems/activesupport-3.0.9/lib/active_support/dependencies.rb:225:in block in load_dependency' /usr/local/rvm/gems/ruby-1.9.2-p180@enmasse_online/gems/activesupport-3.0.9/lib/active_support/dependencies.rb:596:innew_constants_in'
/usr/local/rvm/gems/ruby-1.9.2-p180@enmasse_online/gems/activesupport-3.0.9/lib/active_support/dependencies.rb:225:in load_dependency' /usr/local/rvm/gems/ruby-1.9.2-p180@enmasse_online/gems/activesupport-3.0.9/lib/active_support/dependencies.rb:239:inrequire'
/usr/local/rvm/gems/ruby-1.9.2-p180@enmasse_online/gems/railties-3.0.9/lib/rails/application.rb:103:in require_environment!' /usr/local/rvm/gems/ruby-1.9.2-p180@enmasse_online/gems/railties-3.0.9/lib/rails/application.rb:218:inblock in initialize_tasks'
/usr/local/rvm/gems/ruby-1.9.2-p180@enmasse_online/gems/rake-0.9.2/lib/rake/task.rb:205:in call' /usr/local/rvm/gems/ruby-1.9.2-p180@enmasse_online/gems/rake-0.9.2/lib/rake/task.rb:205:inblock in execute'
/usr/local/rvm/gems/ruby-1.9.2-p180@enmasse_online/gems/rake-0.9.2/lib/rake/task.rb:200:in each' /usr/local/rvm/gems/ruby-1.9.2-p180@enmasse_online/gems/rake-0.9.2/lib/rake/task.rb:200:inexecute'
/usr/local/rvm/gems/ruby-1.9.2-p180@enmasse_online/gems/rake-0.9.2/lib/rake/task.rb:158:in block in invoke_with_call_chain' /usr/local/rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/monitor.rb:201:inmon_synchronize'
/usr/local/rvm/gems/ruby-1.9.2-p180@enmasse_online/gems/rake-0.9.2/lib/rake/task.rb:151:in invoke_with_call_chain' /usr/local/rvm/gems/ruby-1.9.2-p180@enmasse_online/gems/rake-0.9.2/lib/rake/task.rb:176:inblock in invoke_prerequisites'
/usr/local/rvm/gems/ruby-1.9.2-p180@enmasse_online/gems/rake-0.9.2/lib/rake/task.rb:174:in each' /usr/local/rvm/gems/ruby-1.9.2-p180@enmasse_online/gems/rake-0.9.2/lib/rake/task.rb:174:ininvoke_prerequisites'
/usr/local/rvm/gems/ruby-1.9.2-p180@enmasse_online/gems/rake-0.9.2/lib/rake/task.rb:157:in block in invoke_with_call_chain' /usr/local/rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/monitor.rb:201:inmon_synchronize'
/usr/local/rvm/gems/ruby-1.9.2-p180@enmasse_online/gems/rake-0.9.2/lib/rake/task.rb:151:in invoke_with_call_chain' /usr/local/rvm/gems/ruby-1.9.2-p180@enmasse_online/gems/rake-0.9.2/lib/rake/task.rb:144:ininvoke'
/usr/local/rvm/gems/ruby-1.9.2-p180@enmasse_online/gems/rake-0.9.2/lib/rake/application.rb:112:in invoke_task' /usr/local/rvm/gems/ruby-1.9.2-p180@enmasse_online/gems/rake-0.9.2/lib/rake/application.rb:90:inblock (2 levels) in top_level'
/usr/local/rvm/gems/ruby-1.9.2-p180@enmasse_online/gems/rake-0.9.2/lib/rake/application.rb:90:in each' /usr/local/rvm/gems/ruby-1.9.2-p180@enmasse_online/gems/rake-0.9.2/lib/rake/application.rb:90:inblock in top_level'
/usr/local/rvm/gems/ruby-1.9.2-p180@enmasse_online/gems/rake-0.9.2/lib/rake/application.rb:129:in standard_exception_handling' /usr/local/rvm/gems/ruby-1.9.2-p180@enmasse_online/gems/rake-0.9.2/lib/rake/application.rb:84:intop_level'
/usr/local/rvm/gems/ruby-1.9.2-p180@enmasse_online/gems/rake-0.9.2/lib/rake/application.rb:62:in block in run' /usr/local/rvm/gems/ruby-1.9.2-p180@enmasse_online/gems/rake-0.9.2/lib/rake/application.rb:129:instandard_exception_handling'
/usr/local/rvm/gems/ruby-1.9.2-p180@enmasse_online/gems/rake-0.9.2/lib/rake/application.rb:59:in run' /usr/local/rvm/gems/ruby-1.9.2-p180@enmasse_online/gems/rake-0.9.2/bin/rake:32:in<top (required)>'
/usr/local/rvm/gems/ruby-1.9.2-p180@enmasse_online/bin/rake:19:in load' /usr/local/rvm/gems/ruby-1.9.2-p180@enmasse_online/bin/rake:19:in

'
Tasks: TOP => db:migrate => environment

vagrant@lucid64:/srv/enmasse-online/current$ ls -la index/development/RefinerySetting/
total 8
drwxrwxrwx 1 vagrant vagrant 4096 2011-07-09 03:37 .
drwxrwxrwx 1 vagrant vagrant 0 2011-07-06 01:22 ..
-rwxrwxrwx 1 vagrant vagrant 99 2011-07-09 03:33 100_114_97.ind
-rwxrwxrwx 1 vagrant vagrant 105 2011-07-09 03:38 100_114_97.ind.tmp
-rwxrwxrwx 1 vagrant vagrant 78 2011-07-06 01:22 117_115_101.ind
-rwxrwxrwx 1 vagrant vagrant 80 2011-07-06 01:22 117_115_101.ind.tmp
-rwxrwxrwx 1 vagrant vagrant 1 2011-07-06 01:22 size
-rwxrwxrwx 1 vagrant vagrant 1 2011-07-06 21:11 size.tmp
-rwxrwxrwx 1 vagrant vagrant 5 2011-07-06 01:22 version
vagrant@lucid64:/srv/enmasse-online/current$ mv index/development/RefinerySetting/100_114_97.ind.tmp index/development/RefinerySetting/100_114_97.ind
vagrant@lucid64:/srv/enmasse-online/current$ ls -la index/development/RefinerySetting/
total 7
drwxrwxrwx 1 vagrant vagrant 4096 2011-07-09 03:39 .
drwxrwxrwx 1 vagrant vagrant 0 2011-07-06 01:22 ..
-rwxrwxrwx 1 vagrant vagrant 105 2011-07-09 03:38 100_114_97.ind
-rwxrwxrwx 1 vagrant vagrant 78 2011-07-06 01:22 117_115_101.ind
-rwxrwxrwx 1 vagrant vagrant 80 2011-07-06 01:22 117_115_101.ind.tmp
-rwxrwxrwx 1 vagrant vagrant 1 2011-07-06 01:22 size
-rwxrwxrwx 1 vagrant vagrant 1 2011-07-06 21:11 size.tmp
-rwxrwxrwx 1 vagrant vagrant 5 2011-07-06 01:22 version
vagrant@lucid64:/srv/enmasse-online/current$

ActsAsIndexed::Storage#windows? should return true if is a Windows filesystem, not platform

While trying to create a new page with Refinery I was receiving the following error message:

Permission denied - (.../tmp/index/development/refinery/page/99_111_109.ind.tmp, .../tmp/index/development/refinery/page/99_111_109.ind`
...rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/fileutils.rb:519:in `rename'`

And it traced back to here.

As many Windows developers that work with Ruby I use a virtual machine for the Linux environment and I work on a shared folder between Windows and Linux.

The problem with this is that in storage.rb, RUBY_PLATFORM[/mswin32|mingw|cygwin/] will throw that I'm on Linux, which is true, but the subsequently operations will fail since they assume it's a Linux filesystem but in reality is in a Windows filesystem.

A workaround is to add the following initializer:

require 'acts_as_indexed'

class ActsAsIndexed::Storage
  def windows?
    @@is_windows ||= true
  end
end

does not support active record non-standard primary keys

rails 3.0.7, acts_as_index 0.7.2 gem

To replicate:

class Example < ActiveRecord::Base
set_primary_key 'example_id'
acts_as_indexed :fields => [:example_content]
end

Then Example.find_with_index('search') dies with ActiveRecord::StatementInvalid: Mysql::Error: Unknown column 'examples.id' in 'where clause' from gems/acts_as_indexed-0.7.2/lib/acts_as_indexed/class_methods.rb:146

Looking at ActsAsIndexed::ClassMethods, it seems it seems like doing something like:

{table_name}.#{primary_key} IN (?)

instead of

{table_name}.id IN (?)

would fix this.

Thanks!

"end of file reached" issue

Hello I started to notice this last night.. and cant seem to be able to log in now..

from rails production log:

Started POST "/refinery/users/login?fromsite=1" for 204.16.153.250 at 2012-11-15 13:22:04 -0800
Completed 500 Internal Server Error in 10786ms

EOFError (end of file reached):
app/controllers/refinery/sessions_controller.rb:22:in `create'

from my log server:
From: cms
Date: 2012-11-15 13:22:12 -0800
Severity: Debug
Facility: graylog2_exceptions
File: /home/playfirst/.rvm/gems/ruby-1.9.3-p286/gems/acts_as_indexed-0.7.8/lib/acts_as_indexed/storage.rb:87
Full message:
/home/playfirst/.rvm/gems/ruby-1.9.3-p286/gems/acts_as_indexed-0.7.8/lib/acts_as_indexed/storage.rb:87:in load' /home/playfirst/.rvm/gems/ruby-1.9.3-p286/gems/acts_as_indexed-0.7.8/lib/acts_as_indexed/storage.rb:87:inblock (3 levels) in operate'
/home/playfirst/.rvm/gems/ruby-1.9.3-p286/gems/acts_as_indexed-0.7.8/lib/acts_as_indexed/storage.rb:86:in open' /home/playfirst/.rvm/gems/ruby-1.9.3-p286/gems/acts_as_indexed-0.7.8/lib/acts_as_indexed/storage.rb:86:inopen'
/home/playfirst/.rvm/gems/ruby-1.9.3-p286/gems/acts_as_indexed-0.7.8/lib/acts_as_indexed/storage.rb:86:in block (2 levels) in operate' /home/playfirst/.rvm/gems/ruby-1.9.3-p286/gems/acts_as_indexed-0.7.8/lib/acts_as_indexed/storage.rb:180:inblock in lock_file'
/home/playfirst/.rvm/gems/ruby-1.9.3-p286/gems/acts_as_indexed-0.7.8/lib/acts_as_indexed/storage.rb:177:in open' /home/playfirst/.rvm/gems/ruby-1.9.3-p286/gems/acts_as_indexed-0.7.8/lib/acts_as_indexed/storage.rb:177:inopen'
/home/playfirst/.rvm/gems/ruby-1.9.3-p286/gems/acts_as_indexed-0.7.8/lib/acts_as_indexed/storage.rb:177:in lock_file' /home/playfirst/.rvm/gems/ruby-1.9.3-p286/gems/acts_as_indexed-0.7.8/lib/acts_as_indexed/storage.rb:83:inblock in operate'
/home/playfirst/.rvm/gems/ruby-1.9.3-p286/gems/acts_as_indexed-0.7.8/lib/acts_as_indexed/storage.rb:80:in each' /home/playfirst/.rvm/gems/ruby-1.9.3-p286/gems/acts_as_indexed-0.7.8/lib/acts_as_indexed/storage.rb:80:inoperate'
/home/playfirst/.rvm/gems/ruby-1.9.3-p286/gems/acts_as_indexed-0.7.8/lib/acts_as_indexed/storage.rb:30:in remove' /home/playfirst/.rvm/gems/ruby-1.9.3-p286/gems/acts_as_indexed-0.7.8/lib/acts_as_indexed/search_index.rb:50:inremove_record'
/home/playfirst/.rvm/gems/ruby-1.9.3-p286/gems/acts_as_indexed-0.7.8/lib/acts_as_indexed/search_index.rb:54:in update_record' /home/playfirst/.rvm/gems/ruby-1.9.3-p286/gems/acts_as_indexed-0.7.8/lib/acts_as_indexed/class_methods.rb:87:inindex_update'
/home/playfirst/.rvm/gems/ruby-1.9.3-p286/gems/acts_as_indexed-0.7.8/lib/acts_as_indexed/instance_methods.rb:28:in update_index' /home/playfirst/.rvm/gems/ruby-1.9.3-p286/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:407:in_run__243750755060159493__update__692564817154729579__callbacks'
/home/playfirst/.rvm/gems/ruby-1.9.3-p286/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:405:in __run_callback' /home/playfirst/.rvm/gems/ruby-1.9.3-p286/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:385:in_run_update_callbacks'
/home/playfirst/.rvm/gems/ruby-1.9.3-p286/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:81:in run_callbacks' /home/playfirst/.rvm/gems/ruby-1.9.3-p286/gems/activerecord-3.2.8/lib/active_record/callbacks.rb:272:inupdate'
/home/playfirst/.rvm/gems/ruby-1.9.3-p286/gems/activerecord-3.2.8/lib/active_record/persistence.rb:347:in create_or_update' /home/playfirst/.rvm/gems/ruby-1.9.3-p286/gems/activerecord-3.2.8/lib/active_record/callbacks.rb:264:inblock in create_or_update'
/home/playfirst/.rvm/gems/ruby-1.9.3-p286/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:425:in _run__243750755060159493__save__692564817154729579__callbacks' /home/playfirst/.rvm/gems/ruby-1.9.3-p286/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:405:in__run_callback'
/home/playfirst/.rvm/gems/ruby-1.9.3-p286/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:385:in _run_save_callbacks' /home/playfirst/.rvm/gems/ruby-1.9.3-p286/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:81:inrun_callbacks'
/home/playfirst/.rvm/gems/ruby-1.9.3-p286/gems/activerecord-3.2.8/lib/active_record/callbacks.rb:264:in create_or_update' /home/playfirst/.rvm/gems/ruby-1.9.3-p286/gems/activerecord-3.2.8/lib/active_record/persistence.rb:84:insave'
/home/playfirst/.rvm/gems/ruby-1.9.3-p286/gems/activerecord-3.2.8/lib/active_record/validations.rb:50:in save' /home/playfirst/.rvm/gems/ruby-1.9.3-p286/gems/activerecord-3.2.8/lib/active_record/attribute_methods/dirty.rb:22:insave'
/home/playfirst/.rvm/gems/ruby-1.9.3-p286/gems/activerecord-3.2.8/lib/active_record/transactions.rb:241:in block (2 levels) in save' /home/playfirst/.rvm/gems/ruby-1.9.3-p286/gems/activerecord-3.2.8/lib/active_record/transactions.rb:295:inblock in with_transaction_returning_status'
/home/playfirst/.rvm/gems/ruby-1.9.3-p286/gems/activerecord-3.2.8/lib/active_record/connection_adapters/abstract/database_statements.rb:192:in transaction' /home/playfirst/.rvm/gems/ruby-1.9.3-p286/gems/activerecord-3.2.8/lib/active_record/transactions.rb:208:intransaction'
/home/playfirst/.rvm/gems/ruby-1.9.3-p286/gems/activerecord-3.2.8/lib/active_record/transactions.rb:293:in with_transaction_returning_status' /home/playfirst/.rvm/gems/ruby-1.9.3-p286/gems/activerecord-3.2.8/lib/active_record/transactions.rb:241:inblock in save'
/home/playfirst/.rvm/gems/ruby-1.9.3-p286/gems/activerecord-3.2.8/lib/active_record/transactions.rb:252:in rollback_active_record_state!' /home/playfirst/.rvm/gems/ruby-1.9.3-p286/gems/activerecord-3.2.8/lib/active_record/transactions.rb:240:insave'
/home/playfirst/.rvm/gems/ruby-1.9.3-p286/gems/devise-2.0.4/lib/devise/models/trackable.rb:26:in update_tracked_fields!' /home/playfirst/.rvm/gems/ruby-1.9.3-p286/gems/devise-2.0.4/lib/devise/hooks/trackable.rb:7:inblock in <top (required)>'
/home/playfirst/.rvm/gems/ruby-1.9.3-p286/gems/warden-1.1.1/lib/warden/hooks.rb:14:in call' /home/playfirst/.rvm/gems/ruby-1.9.3-p286/gems/warden-1.1.1/lib/warden/hooks.rb:14:inblock in _run_callbacks'
/home/playfirst/.rvm/gems/ruby-1.9.3-p286/gems/warden-1.1.1/lib/warden/hooks.rb:9:in each' /home/playfirst/.rvm/gems/ruby-1.9.3-p286/gems/warden-1.1.1/lib/warden/hooks.rb:9:in_run_callbacks'
/home/playfirst/.rvm/gems/ruby-1.9.3-p286/gems/warden-1.1.1/lib/warden/manager.rb:53:in _run_callbacks' /home/playfirst/.rvm/gems/ruby-1.9.3-p286/gems/warden-1.1.1/lib/warden/proxy.rb:165:inset_user'
/home/playfirst/.rvm/gems/ruby-1.9.3-p286/gems/devise-2.0.4/lib/devise/controllers/helpers.rb:124:in sign_in' /var/www/playfirst_cms/app/controllers/refinery/sessions_controller.rb:22:increate'
/home/playfirst/.rvm/gems/ruby-1.9.3-p286/gems/actionpack-3.2.8/lib/action_controller/metal/implicit_render.rb:4:in send_action' /home/playfirst/.rvm/gems/ruby-1.9.3-p286/gems/actionpack-3.2.8/lib/abstract_controller/base.rb:167:inprocess_action'
/home/playfirst/.rvm/gems/ruby-1.9.3-p286/gems/actionpack-3.2.8/lib/action_controller/metal/rendering.rb:10:in process_action' /home/playfirst/.rvm/gems/ruby-1.9.3-p286/gems/actionpack-3.2.8/lib/abstract_controller/callbacks.rb:18:inblock in process_action'
/home/playfirst/.rvm/gems/ruby-1.9.3-p286/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:491:in _run__4547756213461430065__process_action__3619842155605981004__callbacks' /home/playfirst/.rvm/gems/ruby-1.9.3-p286/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:405:in__run_callback'
/home/playfirst/.rvm/gems/ruby-1.9.3-p286/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:385:in _run_process_action_callbacks' /home/playfirst/.rvm/gems/ruby-1.9.3-p286/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:81:inrun_callbacks'
/home/playfirst/.rvm/gems/ruby-1.9.3-p286/gems/actionpack-3.2.8/lib/abstract_controller/callbacks.rb:17:in process_action' /home/playfirst/.rvm/gems/ruby-1.9.3-p286/gems/actionpack-3.2.8/lib/action_controller/metal/rescue.rb:29:inprocess_action'
/home/playfirst/.rvm/gems/ruby-1.9.3-p286/gems/actionpack-3.2.8/lib/action_controller/metal/instrumentation.rb:30:in block in process_action' /home/playfirst/.rvm/gems/ruby-1.9.3-p286/gems/activesupport-3.2.8/lib/active_support/notifications.rb:123:inblock in instrument'
/home/playfirst/.rvm/gems/ruby-1.9.3-p286/gems/activesupport-3.2.8/lib/active_support/notifications/instrumenter.rb:20:in instrument' /home/playfirst/.rvm/gems/ruby-1.9.3-p286/gems/activesupport-3.2.8/lib/active_support/notifications.rb:123:ininstrument'
/home/playfirst/.rvm/gems/ruby-1.9.3-p286/gems/actionpack-3.2.8/lib/action_controller/metal/instrumentation.rb:29:in process_action' /home/playfirst/.rvm/gems/ruby-1.9.3-p286/gems/actionpack-3.2.8/lib/action_controller/metal/params_wrapper.rb:207:inprocess_action'
/home/playfirst/.rvm/gems/ruby-1.9.3-p286/gems/activerecord-3.2.8/lib/active_record/railties/controller_runtime.rb:18:in process_action' /home/playfirst/.rvm/gems/ruby-1.9.3-p286/gems/actionpack-3.2.8/lib/abstract_controller/base.rb:121:inprocess'
/home/playfirst/.rvm/gems/ruby-1.9.3-p286/gems/actionpack-3.2.8/lib/abstract_controller/rendering.rb:45:in process' /home/playfirst/.rvm/gems/ruby-1.9.3-p286/gems/actionpack-3.2.8/lib/action_controller/metal.rb:203:indispatch'
/home/playfirst/.rvm/gems/ruby-1.9.3-p286/gems/actionpack-3.2.8/lib/action_controller/metal/rack_delegation.rb:14:in dispatch' /home/playfirst/.rvm/gems/ruby-1.9.3-p286/gems/actionpack-3.2.8/lib/action_controller/metal.rb:246:inblock in action'
/home/playfirst/.rvm/gems/ruby-1.9.3-p286/gems/actionpack-3.2.8/lib/action_dispatch/routing/route_set.rb:73:in call' /home/playfirst/.rvm/gems/ruby-1.9.3-p286/gems/actionpack-3.2.8/lib/action_dispatch/routing/route_set.rb:73:indispatch'
/home/playfirst/.rvm/gems/ruby-1.9.3-p286/gems/actionpack-3.2.8/lib/action_dispatch/routing/route_set.rb:36:in call' /home/playfirst/.rvm/gems/ruby-1.9.3-p286/gems/actionpack-3.2.8/lib/action_dispatch/routing/mapper.rb:42:incall'
/home/playfirst/.rvm/gems/ruby-1.9.3-p286/gems/journey-1.0.4/lib/journey/router.rb:68:in block in call' /home/playfirst/.rvm/gems/ruby-1.9.3-p286/gems/journey-1.0.4/lib/journey/router.rb:56:ineach'
/home/playfirst/.rvm/gems/ruby-1.9.3-p286/gems/journey-1.0.4/lib/journey/router.rb:56:in call' /home/playfirst/.rvm/gems/ruby-1.9.3-p286/gems/actionpack-3.2.8/lib/action_dispatch/routing/route_set.rb:600:incall'
/home/playfirst/.rvm/gems/ruby-1.9.3-p286/gems/railties-3.2.8/lib/rails/engine.rb:479:in call' /home/playfirst/.rvm/gems/ruby-1.9.3-p286/gems/railties-3.2.8/lib/rails/railtie/configurable.rb:30:inmethod_missing'
/home/playfirst/.rvm/gems/ruby-1.9.3-p286/gems/journey-1.0.4/lib/journey/router.rb:68:in block in call' /home/playfirst/.rvm/gems/ruby-1.9.3-p286/gems/journey-1.0.4/lib/journey/router.rb:56:ineach'
/home/playfirst/.rvm/gems/ruby-1.9.3-p286/gems/journey-1.0.4/lib/journey/router.rb:56:in call' /home/playfirst/.rvm/gems/ruby-1.9.3-p286/gems/actionpack-3.2.8/lib/action_dispatch/routing/route_set.rb:600:incall'
/home/playfirst/.rvm/gems/ruby-1.9.3-p286/gems/graylog2_exceptions-1.3.0/lib/graylog2_exceptions.rb:30:in _call' /home/playfirst/.rvm/gems/ruby-1.9.3-p286/gems/graylog2_exceptions-1.3.0/lib/graylog2_exceptions.rb:24:incall'
/home/playfirst/.rvm/gems/ruby-1.9.3-p286/gems/warden-1.1.1/lib/warden/manager.rb:35:in block in call' /home/playfirst/.rvm/gems/ruby-1.9.3-p286/gems/warden-1.1.1/lib/warden/manager.rb:34:incatch'
/home/playfirst/.rvm/gems/ruby-1.9.3-p286/gems/warden-1.1.1/lib/warden/manager.rb:34:in call' /home/playfirst/.rvm/gems/ruby-1.9.3-p286/gems/actionpack-3.2.8/lib/action_dispatch/middleware/best_standards_support.rb:17:incall'
/home/playfirst/.rvm/gems/ruby-1.9.3-p286/gems/rack-1.4.1/lib/rack/etag.rb:23:in call' /home/playfirst/.rvm/gems/ruby-1.9.3-p286/gems/rack-1.4.1/lib/rack/conditionalget.rb:35:incall'
/home/playfirst/.rvm/gems/ruby-1.9.3-p286/gems/actionpack-3.2.8/lib/action_dispatch/middleware/head.rb:14:in call' /home/playfirst/.rvm/gems/ruby-1.9.3-p286/gems/actionpack-3.2.8/lib/action_dispatch/middleware/params_parser.rb:21:incall'
/home/playfirst/.rvm/gems/ruby-1.9.3-p286/gems/actionpack-3.2.8/lib/action_dispatch/middleware/flash.rb:242:in call' /home/playfirst/.rvm/gems/ruby-1.9.3-p286/gems/rack-1.4.1/lib/rack/session/abstract/id.rb:205:incontext'
/home/playfirst/.rvm/gems/ruby-1.9.3-p286/gems/rack-1.4.1/lib/rack/session/abstract/id.rb:200:in call' /home/playfirst/.rvm/gems/ruby-1.9.3-p286/gems/actionpack-3.2.8/lib/action_dispatch/middleware/cookies.rb:339:incall'
/home/playfirst/.rvm/gems/ruby-1.9.3-p286/gems/dragonfly-0.9.12/lib/dragonfly/cookie_monster.rb:9:in call' /home/playfirst/.rvm/gems/ruby-1.9.3-p286/gems/activerecord-3.2.8/lib/active_record/query_cache.rb:64:incall'
/home/playfirst/.rvm/gems/ruby-1.9.3-p286/gems/activerecord-3.2.8/lib/active_record/connection_adapters/abstract/connection_pool.rb:473:in call' /home/playfirst/.rvm/gems/ruby-1.9.3-p286/gems/actionpack-3.2.8/lib/action_dispatch/middleware/callbacks.rb:28:inblock in call'
/home/playfirst/.rvm/gems/ruby-1.9.3-p286/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:405:in _run__2493813651070428835__call__692564817154729579__callbacks' /home/playfirst/.rvm/gems/ruby-1.9.3-p286/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:405:in__run_callback'
/home/playfirst/.rvm/gems/ruby-1.9.3-p286/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:385:in _run_call_callbacks' /home/playfirst/.rvm/gems/ruby-1.9.3-p286/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:81:inrun_callbacks'
/home/playfirst/.rvm/gems/ruby-1.9.3-p286/gems/actionpack-3.2.8/lib/action_dispatch/middleware/callbacks.rb:27:in call' /home/playfirst/.rvm/gems/ruby-1.9.3-p286/gems/dragonfly-0.9.12/lib/dragonfly/middleware.rb:13:incall'
/home/playfirst/.rvm/gems/ruby-1.9.3-p286/gems/dragonfly-0.9.12/lib/dragonfly/middleware.rb:13:in call' /home/playfirst/.rvm/gems/ruby-1.9.3-p286/gems/rack-cache-1.2/lib/rack/cache/context.rb:136:inforward'
/home/playfirst/.rvm/gems/ruby-1.9.3-p286/gems/rack-cache-1.2/lib/rack/cache/context.rb:143:in pass' /home/playfirst/.rvm/gems/ruby-1.9.3-p286/gems/rack-cache-1.2/lib/rack/cache/context.rb:155:ininvalidate'
/home/playfirst/.rvm/gems/ruby-1.9.3-p286/gems/rack-cache-1.2/lib/rack/cache/context.rb:71:in call!' /home/playfirst/.rvm/gems/ruby-1.9.3-p286/gems/rack-cache-1.2/lib/rack/cache/context.rb:51:incall'
/home/playfirst/.rvm/gems/ruby-1.9.3-p286/gems/rack-cache-1.2/lib/rack/cache/context.rb:136:in forward' /home/playfirst/.rvm/gems/ruby-1.9.3-p286/gems/rack-cache-1.2/lib/rack/cache/context.rb:143:inpass'
/home/playfirst/.rvm/gems/ruby-1.9.3-p286/gems/rack-cache-1.2/lib/rack/cache/context.rb:155:in invalidate' /home/playfirst/.rvm/gems/ruby-1.9.3-p286/gems/rack-cache-1.2/lib/rack/cache/context.rb:71:incall!'
/home/playfirst/.rvm/gems/ruby-1.9.3-p286/gems/rack-cache-1.2/lib/rack/cache/context.rb:51:in call' /home/playfirst/.rvm/gems/ruby-1.9.3-p286/gems/actionpack-3.2.8/lib/action_dispatch/middleware/remote_ip.rb:31:incall'
/home/playfirst/.rvm/gems/ruby-1.9.3-p286/gems/actionpack-3.2.8/lib/action_dispatch/middleware/debug_exceptions.rb:16:in call' /home/playfirst/.rvm/gems/ruby-1.9.3-p286/gems/actionpack-3.2.8/lib/action_dispatch/middleware/show_exceptions.rb:56:incall'
/home/playfirst/.rvm/gems/ruby-1.9.3-p286/gems/railties-3.2.8/lib/rails/rack/logger.rb:26:in call_app' /home/playfirst/.rvm/gems/ruby-1.9.3-p286/gems/railties-3.2.8/lib/rails/rack/logger.rb:16:incall'
/home/playfirst/.rvm/gems/ruby-1.9.3-p286/gems/actionpack-3.2.8/lib/action_dispatch/middleware/request_id.rb:22:in call' /home/playfirst/.rvm/gems/ruby-1.9.3-p286/gems/rack-1.4.1/lib/rack/methodoverride.rb:21:incall'
/home/playfirst/.rvm/gems/ruby-1.9.3-p286/gems/rack-1.4.1/lib/rack/runtime.rb:17:in call' /home/playfirst/.rvm/gems/ruby-1.9.3-p286/gems/rack-1.4.1/lib/rack/lock.rb:15:incall'
/home/playfirst/.rvm/gems/ruby-1.9.3-p286/gems/rack-cache-1.2/lib/rack/cache/context.rb:136:in forward' /home/playfirst/.rvm/gems/ruby-1.9.3-p286/gems/rack-cache-1.2/lib/rack/cache/context.rb:143:inpass'
/home/playfirst/.rvm/gems/ruby-1.9.3-p286/gems/rack-cache-1.2/lib/rack/cache/context.rb:155:in invalidate' /home/playfirst/.rvm/gems/ruby-1.9.3-p286/gems/rack-cache-1.2/lib/rack/cache/context.rb:71:incall!'
/home/playfirst/.rvm/gems/ruby-1.9.3-p286/gems/rack-cache-1.2/lib/rack/cache/context.rb:51:in call' /home/playfirst/.rvm/gems/ruby-1.9.3-p286/gems/railties-3.2.8/lib/rails/engine.rb:479:incall'
/home/playfirst/.rvm/gems/ruby-1.9.3-p286/gems/railties-3.2.8/lib/rails/application.rb:223:in call' /home/playfirst/.rvm/gems/ruby-1.9.3-p286/gems/railties-3.2.8/lib/rails/railtie/configurable.rb:30:inmethod_missing'
/home/playfirst/.rvm/gems/ruby-1.9.3-p286/gems/passenger-3.0.18/lib/phusion_passenger/rack/request_handler.rb:96:in process_request' /home/playfirst/.rvm/gems/ruby-1.9.3-p286/gems/passenger-3.0.18/lib/phusion_passenger/abstract_request_handler.rb:516:inaccept_and_process_next_request'
/home/playfirst/.rvm/gems/ruby-1.9.3-p286/gems/passenger-3.0.18/lib/phusion_passenger/abstract_request_handler.rb:274:in main_loop' /home/playfirst/.rvm/gems/ruby-1.9.3-p286/gems/passenger-3.0.18/lib/phusion_passenger/rack/application_spawner.rb:206:instart_request_handler'
/home/playfirst/.rvm/gems/ruby-1.9.3-p286/gems/passenger-3.0.18/lib/phusion_passenger/rack/application_spawner.rb:171:in block in handle_spawn_application' /home/playfirst/.rvm/gems/ruby-1.9.3-p286/gems/passenger-3.0.18/lib/phusion_passenger/utils.rb:470:insafe_fork'
/home/playfirst/.rvm/gems/ruby-1.9.3-p286/gems/passenger-3.0.18/lib/phusion_passenger/rack/application_spawner.rb:166:in handle_spawn_application' /home/playfirst/.rvm/gems/ruby-1.9.3-p286/gems/passenger-3.0.18/lib/phusion_passenger/abstract_server.rb:357:inserver_main_loop'
/home/playfirst/.rvm/gems/ruby-1.9.3-p286/gems/passenger-3.0.18/lib/phusion_passenger/abstract_server.rb:206:in start_synchronously' /home/playfirst/.rvm/gems/ruby-1.9.3-p286/gems/passenger-3.0.18/lib/phusion_passenger/abstract_server.rb:180:instart'
/home/playfirst/.rvm/gems/ruby-1.9.3-p286/gems/passenger-3.0.18/lib/phusion_passenger/rack/application_spawner.rb:129:in start' /home/playfirst/.rvm/gems/ruby-1.9.3-p286/gems/passenger-3.0.18/lib/phusion_passenger/spawn_manager.rb:253:inblock (2 levels) in spawn_rack_application'
/home/playfirst/.rvm/gems/ruby-1.9.3-p286/gems/passenger-3.0.18/lib/phusion_passenger/abstract_server_collection.rb:132:in lookup_or_add' /home/playfirst/.rvm/gems/ruby-1.9.3-p286/gems/passenger-3.0.18/lib/phusion_passenger/spawn_manager.rb:246:inblock in spawn_rack_application'
/home/playfirst/.rvm/gems/ruby-1.9.3-p286/gems/passenger-3.0.18/lib/phusion_passenger/abstract_server_collection.rb:82:in block in synchronize' <internal:prelude>:10:insynchronize'
/home/playfirst/.rvm/gems/ruby-1.9.3-p286/gems/passenger-3.0.18/lib/phusion_passenger/abstract_server_collection.rb:79:in synchronize' /home/playfirst/.rvm/gems/ruby-1.9.3-p286/gems/passenger-3.0.18/lib/phusion_passenger/spawn_manager.rb:244:inspawn_rack_application'
/home/playfirst/.rvm/gems/ruby-1.9.3-p286/gems/passenger-3.0.18/lib/phusion_passenger/spawn_manager.rb:137:in spawn_application' /home/playfirst/.rvm/gems/ruby-1.9.3-p286/gems/passenger-3.0.18/lib/phusion_passenger/spawn_manager.rb:275:inhandle_spawn_application'
/home/playfirst/.rvm/gems/ruby-1.9.3-p286/gems/passenger-3.0.18/lib/phusion_passenger/abstract_server.rb:357:in server_main_loop' /home/playfirst/.rvm/gems/ruby-1.9.3-p286/gems/passenger-3.0.18/lib/phusion_passenger/abstract_server.rb:206:instart_synchronously'
/home/playfirst/.rvm/gems/ruby-1.9.3-p286/gems/passenger-3.0.18/helper-scripts/passenger-spawn-server:99:in `

'

Argument Error: dump format error(0x61)

It doesn't happen with every record - just a lot of them. I couldn't find anything consistent between the problem records...

Here's the trace:

ArgumentError: dump format error(0x61)
from /var/www/production/ficly/vendor/plugins/acts_as_indexed/lib/search_index.rb:297:in load' from /var/www/production/ficly/vendor/plugins/acts_as_indexed/lib/search_index.rb:297:inload_atoms'
from /var/www/production/ficly/vendor/plugins/acts_as_indexed/lib/search_index.rb:296:in open' from /var/www/production/ficly/vendor/plugins/acts_as_indexed/lib/search_index.rb:296:inload_atoms'
from /var/www/production/ficly/vendor/plugins/acts_as_indexed/lib/search_index.rb:294:in each' from /var/www/production/ficly/vendor/plugins/acts_as_indexed/lib/search_index.rb:294:inload_atoms'
from /var/www/production/ficly/vendor/plugins/acts_as_indexed/lib/search_index.rb:27:in add_record' from /var/www/production/ficly/vendor/plugins/acts_as_indexed/lib/acts_as_indexed.rb:70:inindex_add'
from /var/www/production/ficly/vendor/plugins/acts_as_indexed/lib/acts_as_indexed.rb:199:in add_to_index' from /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.3/lib/active_support/callbacks.rb:178:insend'
from /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.3/lib/active_support/callbacks.rb:178:in evaluate_method' from /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.3/lib/active_support/callbacks.rb:166:incall'
from /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.3/lib/active_support/callbacks.rb:93:in run' from /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.3/lib/active_support/callbacks.rb:92:ineach'
from /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.3/lib/active_support/callbacks.rb:92:in send' from /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.3/lib/active_support/callbacks.rb:92:inrun'

Access file problems on Windows

Hi folks,

I am having an unexpected behavior of the gem under Windows. My environment is: 64-bit Window 7, 64-bit Sun JDK 1.6.0_37, 64-bit JRuby 1.6.8, Rails 3.2.2, acts_as_indexed 0.7.8, devise 2.0.4.

While running my Rails application I got the following problem, coming from the Devise gem:

IOError in Devise::RegistrationsController#create

The process cannot access the file because another process has locked a portion of the file

While debugging the application with RubyMine IDE, I found that the issue is occurring in acts_as_indexed/lib/acts_as_indexed/storage.rb, line 174, method lock_file. Strangely enough, in the debugger I found that the class variable @@is_windows was having the nil value, which is treated as false from a boolean perspective.

By applying a runtime replacement of the value to "true" in the debugger, my application worked fine. So I guess that this is a bug.

Kindest Regards,
Krum.

https://www.savethekoala.com/

Search Term == Entire Field misses record

Hi Douglas. I'm having a little trouble with Acts_As_Index missing some records. I have encountered several cases where find_with_index does not return a matching record. In every case I have observed that the query has been an entire searchable field (e.g. find_with_index('dogs') should return a record with an indexed field of 'dogs'), although find_with_index certainly doesn't fail for all such queries.

I have tried deleting the index files to force a rebuild, but the same records are missed each time.

I would be happy to send you a copy of my index files and some sample failing queries if this will help you track down the bug.

Using "-" in query

If I use "-" in a query it's treated as a NOT operator. Is there a way to escape this behavior and treat "-" character as regular character.?

Fot example when I want to search for string like "BLABLA-XX".

DEPRECATION WARNING: Use toplevel init.rb; rails/init.rb is deprecated: /Users/thomas/ruby/hotaru/vendor/plugins/acts_as_indexed/rails/init.rb. (called from /Users/thomas/ruby/hotaru/config/environment.rb:4)

I receive depreciation warning after install as plugin:

"DEPRECATION WARNING: Use toplevel init.rb; rails/init.rb is deprecated: /Users/thomas/ruby/hotaru/vendor/plugins/acts_as_indexed/rails/init.rb. (called from /Users/thomas/ruby/hotaru/config/environment.rb:4)"

Moving the init.rb file out of the ruby folder (in the main folder of the plugin resolve the issue for me locally.

My environment is rails 3.0.10 ruby 1.9.2.

error "ArgumentError: undefined class/module Foo"

Hi,

I use the plugin version of acts_as_indexed in my Rails 2.3.4 application. I had installed the plugin in July 2009 and it was working fine.

I've updated the plugin with the latest version available in the github repository (to see if it fixes the issue http://github.com/dougal/acts_as_indexed/issues#issue/2), but now when I try to use the with_index scope to search existing data in my application I get the following error. Looks like it occurs on the Marshal loading (http://github.com/dougal/acts_as_indexed/blob/master/lib/acts_as_indexed/search_index.rb#L353)

I've tried to use it in a new freshly created Rails 2.3.4 application and I get no problem, it is working as expected.

The error:

Product.with_query "aproducname"
Query not in cache, running search.
atom_file = #Pathname:/myproject/index/development/Product/122_111_101
ArgumentError: undefined class/module Foo::
from /myproject/vendor/plugins/acts_as_indexed/lib/acts_as_indexed/search_index.rb:354:in load' from /myproject/vendor/plugins/acts_as_indexed/lib/acts_as_indexed/search_index.rb:354:inload_atoms'
from /usr/local/lib/ruby/1.8/pathname.rb:798:in open' from /usr/local/lib/ruby/1.8/pathname.rb:798:inopen'
from /myproject/vendor/plugins/acts_as_indexed/lib/acts_as_indexed/search_index.rb:353:in load_atoms' from /myproject/vendor/plugins/acts_as_indexed/lib/acts_as_indexed/search_index.rb:351:ineach'
from /myproject/vendor/plugins/acts_as_indexed/lib/acts_as_indexed/search_index.rb:351:in load_atoms' from /myproject/vendor/plugins/acts_as_indexed/lib/acts_as_indexed/search_index.rb:348:ineach'
from /myproject/vendor/plugins/acts_as_indexed/lib/acts_as_indexed/search_index.rb:348:in load_atoms' from /myproject/vendor/plugins/acts_as_indexed/lib/acts_as_indexed/search_index.rb:84:insearch'
from /myproject/vendor/plugins/acts_as_indexed/lib/acts_as_indexed.rb:144:in search_index' from /myproject/vendor/plugins/acts_as_indexed/lib/acts_as_indexed.rb:74:inacts_as_indexed'
from /myproject/vendor/rails/activerecord/lib/active_record/named_scope.rb:92:in call' from /myproject/vendor/rails/activerecord/lib/active_record/named_scope.rb:92:innamed_scope'
from /myproject/vendor/rails/activerecord/lib/active_record/named_scope.rb:97:in call' from /myproject/vendor/rails/activerecord/lib/active_record/named_scope.rb:97:inwith_query'

Fails when reading broken index file

Hi,

We use RefineryCMS-blog which is a simple engine within RefineryCMS. acts_as_indexed is used for indexing posts, comments and categories.

For example, a Post has the declaration (code snippet):

acts_as_indexed :fields => [:title, :body]

We are running acts_as_indexed-0.7.8, refinerycms-2.0.9, refinerycms-blog-2-0-stable. Refinery 2.0.9 locks us these specific version . We have a lot of Refinery customisations we can't easily upgrade RefineryCMS.

This morning we had the below sequence of errors:

1. EOFError: end of file reached
/vendor/bundle/ruby/1.9.1/gems/acts_as_indexed-0.7.8/lib/acts_as_indexed/storage.rb:87 in "load"
/vendor/bundle/ruby/1.9.1/gems/acts_as_indexed-0.7.8/lib/acts_as_indexed/storage.rb:87 in "block (3 levels) in operate"
/vendor/bundle/ruby/1.9.1/gems/acts_as_indexed-0.7.8/lib/acts_as_indexed/storage.rb:86 in "open"
/vendor/bundle/ruby/1.9.1/gems/acts_as_indexed-0.7.8/lib/acts_as_indexed/storage.rb:86 in "open"
/vendor/bundle/ruby/1.9.1/gems/acts_as_indexed-0.7.8/lib/acts_as_indexed/storage.rb:86 in "block (2 levels) in operate"
/vendor/bundle/ruby/1.9.1/gems/acts_as_indexed-0.7.8/lib/acts_as_indexed/storage.rb:180 in "block in lock_file"
/vendor/bundle/ruby/1.9.1/gems/acts_as_indexed-0.7.8/lib/acts_as_indexed/storage.rb:177 in "open"
/vendor/bundle/ruby/1.9.1/gems/acts_as_indexed-0.7.8/lib/acts_as_indexed/storage.rb:177 in "open"
/vendor/bundle/ruby/1.9.1/gems/acts_as_indexed-0.7.8/lib/acts_as_indexed/storage.rb:177 in "lock_file"
/vendor/bundle/ruby/1.9.1/gems/acts_as_indexed-0.7.8/lib/acts_as_indexed/storage.rb:83 in "block in operate"
/vendor/bundle/ruby/1.9.1/gems/acts_as_indexed-0.7.8/lib/acts_as_indexed/storage.rb:80 in "each"
/vendor/bundle/ruby/1.9.1/gems/acts_as_indexed-0.7.8/lib/acts_as_indexed/storage.rb:80 in "operate"
/vendor/bundle/ruby/1.9.1/gems/acts_as_indexed-0.7.8/lib/acts_as_indexed/storage.rb:30 in "remove"
/vendor/bundle/ruby/1.9.1/gems/acts_as_indexed-0.7.8/lib/acts_as_indexed/search_index.rb:50 in "remove_record"
/vendor/bundle/ruby/1.9.1/gems/acts_as_indexed-0.7.8/lib/acts_as_indexed/search_index.rb:54 in "update_record"
/vendor/bundle/ruby/1.9.1/gems/acts_as_indexed-0.7.8/lib/acts_as_indexed/class_methods.rb:87 in "index_update"
/vendor/bundle/ruby/1.9.1/gems/acts_as_indexed-0.7.8/lib/acts_as_indexed/instance_methods.rb:28 in "update_index"
2. Errno::ENOENT: No such file or directory - [rails_root]/tmp/index/production/refinery/blog/post/99_111_109.ind.tmp
/usr/local/rbenv/versions/1.9.3-p385/lib/ruby/1.9.1/fileutils.rb:1515 in "stat"
/usr/local/rbenv/versions/1.9.3-p385/lib/ruby/1.9.1/fileutils.rb:1515 in "block in fu_each_src_dest"
/usr/local/rbenv/versions/1.9.3-p385/lib/ruby/1.9.1/fileutils.rb:1531 in "fu_each_src_dest0"
/usr/local/rbenv/versions/1.9.3-p385/lib/ruby/1.9.1/fileutils.rb:1513 in "fu_each_src_dest"
/usr/local/rbenv/versions/1.9.3-p385/lib/ruby/1.9.1/fileutils.rb:508 in "mv"
/vendor/bundle/ruby/1.9.1/gems/acts_as_indexed-0.7.8/lib/acts_as_indexed/storage.rb:169 in "write_file"
3. ArgumentError: dump format error(0x2)
/vendor/bundle/ruby/1.9.1/gems/acts_as_indexed-0.7.8/lib/acts_as_indexed/storage.rb:87 in "load"
/vendor/bundle/ruby/1.9.1/gems/acts_as_indexed-0.7.8/lib/acts_as_indexed/storage.rb:87 in "block (3 levels) in operate"
/vendor/bundle/ruby/1.9.1/gems/acts_as_indexed-0.7.8/lib/acts_as_indexed/storage.rb:86 in "open"
/vendor/bundle/ruby/1.9.1/gems/acts_as_indexed-0.7.8/lib/acts_as_indexed/storage.rb:86 in "open"
/vendor/bundle/ruby/1.9.1/gems/acts_as_indexed-0.7.8/lib/acts_as_indexed/storage.rb:86 in "block (2 levels) in operate"
/vendor/bundle/ruby/1.9.1/gems/acts_as_indexed-0.7.8/lib/acts_as_indexed/storage.rb:180 in "block in lock_file"
/vendor/bundle/ruby/1.9.1/gems/acts_as_indexed-0.7.8/lib/acts_as_indexed/storage.rb:177 in "open"
/vendor/bundle/ruby/1.9.1/gems/acts_as_indexed-0.7.8/lib/acts_as_indexed/storage.rb:177 in "open"
/vendor/bundle/ruby/1.9.1/gems/acts_as_indexed-0.7.8/lib/acts_as_indexed/storage.rb:177 in "lock_file"

Given the order of errors, I presume that for some reason the index file couldn't be written correctly, which then caused read and write errors.

I have checked the server and we have plenty of hard drive space, there were no deployments at the time and there were no other outages anywhere. I was able to resolve it by deleting the tmp/index directory, but in the heat of the moment I forgot to keep a backup of the broken file to investigate it further.

We have had the same problem 3 or 4 times in the last 6 months or so it's starting to become a bit of a problem with no known cause or obvious fix.

I realise that you have now moved the codebase onto v0.8.3 but perhaps you could give me some guidance here? Is there anything we can do? It doesn't seem to be a problem with Refinery's integration of acts_as_indexed into their app. Looking at the code there doesn't seem to be any handling of error cases, is it done somewhere else? What should acts_as_indexed do if the index file is somehow corrupted?

Thanks for your help - much appreciated. If you need any other information please let me know.

Dave

search not working

I have Windows, ruby 1.9.3p0, mysql as a database

class Tour
  acts_as_indexed :fields => [:ascii_name, :type_name, :ascii_description, :routename, :cover_image_uid, :cover_image_name]
private

  def ascii_name
    (self.name || '').to_ascii
  end

  def ascii_description
    (self.description || '').to_ascii
  end
end
irb(main):005:0> Tour.last.name
=> "Нью-Йорк + Отдых в Мексике (без авиа)"
irb(main):006:0> Tour.last.name.to_ascii
=> "N'iu-Iork + Otdykh v Mieksikie (biez avia)"
irb(main):007:0> Tour.with_query('avia')
=> []

I have removed removed all indexes and re-saved all documents. But still cannot find anything

Can multiple models be searched at the same time?

Hi there,

I'm looking into using acts_as_indexed for a "Site Search" facility.

I can see that I can easily index the various models I need, and then search them each separately - e.g. a Page model, a BlogArticle model, etc.

But is there way of searching (and ranking) multiple indexed models all in one go, a returning an array that might, say, include a Page, a BlogArticle, another Page, etc. ?

Many thanks for any advice,
Neil.

ActiveRecord macro does not respect alias_attribute

Hi

I have a model, with a string field, name, and I am using the alias_attribute (http://bit.ly/aZ25eE) method to alias this field to title. I then define indexing on this aliased field with acts_as_indexed :fields => [:title]. Fulltext queries on this model should then return results from the name column, however they don't.

I know this is a minor thing, but I sometimes lose track of which is the original column and which is the alias, which is kind of the point. I don't want to have to care about which is the original and which is the alias, I want to be able to use whichever is most human-readable and makes most sense at the time.

Limits return inconsistent results

I can run the same query with different limits and get completely different results.

For example, I have a User.create(first_name: "Josh"). When I call User.find_with_index("Josh", { :limit => 10 }), it returns an empty array, but User.find_with_index("Josh", { :limit => 40 }) will return the desired result.

Strangely, anything >= 31 that I've tried so far works as desired, but anything less does not.

Errors on tests running in parallel

Hi,

I have a RefineryCMS project updated to latest stable version (2.1.3) and after integrate my tests with parallel_tests and zeus (using zeus-parallel_tests), this error is happening randomly on different tests

     Failure/Error: Unable to find matching line from backtrace
     Errno::ENOENT:
       No such file or directory - /Users/marcelopazzo/dev/project/tmp/index/test/refinery/user/114_101_102.ind.tmp
     # <internal:prelude>:10:in `synchronize'
     # -e:1:in `<main>'

These errors looks like what @daveharris reported on #53

I'm trying to fix the errors using different index folders for each processor, but for some reason, even with the code below on my spec_helper.rb, some tests are looking for files on the default index folder:

RSpec.configure do |config|
  config.before :suite do
    ActsAsIndexed.configuration.index_file = [Rails.root, 'tmp', "parallel_index#{ENV['TEST_ENV_NUMBER']}"]
  end
end

Do you have any advice on how I can make this work?

cannot query with chinese

I tried Item.find_with_query('中') and Item.find_with_query('+中'),
but always returned an empty array.

using ree 2011.03 and aai 0.7.2.

How is relevance determined?

I have records where I only care to index their title. So I added:

acts_as_indexed :fields => [:name]

To the model (Artist) and called:

Artist.send(:build_index)

I then tried a test search:

Artist.find_with_index('Miles').each{|a| puts a.name }

Here are the first few lines output:

Miles Benjamin Anthony Robinson
John Miles
Lizzy Miles
Barry Miles
The Buddy Miles Express
Miles Away
Fuzz, Flaykes, & Shakes Vol. 1- 60 Miles High
Miles Kane
Miles
Miles From India
Miles Zuniga
Miles Davis

Seeing as I have an artist with the name "Miles" exactly, I would think that would be deemed the most relevant. Do I have something misconfigured maybe?

Multiple Indexes possible?

Is it possible to use multiple indexes? I would want an index for the titles and a different one for the contents.

Possible? Otherwise a hint for improvement :-)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.