Skip to content
This repository

LoadError (no such file to load -- pg_search/features/dmetaphone): #78

Open
rmontgomery429 opened this Issue December 12, 2012 · 5 comments

2 participants

Ryan Montgomery Grant Hutchins
Ryan Montgomery

This may very well be a Heroku issue but I thought I'd post it here in case others run into the same thing.

I'm running using their Crane database which should be Postgres 9.2.
I'm using the following: pg_search_scope :search_by_description, :against => :description, :using => { :tsearch => {:any_word => true} }

This works locally and has been working in the past although I recently upgraded my database to the Crane database.

The error I am receiving is "LoadError (no such file to load -- pg_search/features/dmetaphone):"

Any insights?

Ryan Montgomery

Just to note that I see dmetaphone requires a contrib package but I'm not using that so maybe my new question is "why is something trying to load pg_search/features/dmetaphone?".

Ryan Montgomery

Ok. So just to try something I ran this migration.

class AddFuzzyStrMatchToPostgres < ActiveRecord::Migration
  def up
    execute "CREATE EXTENSION pg_trgm;"
    execute "CREATE EXTENSION fuzzystrmatch;"
  end

  def down
    execute "DROP EXTENSION pg_trgm;"
    execute "DROP EXTENSION fuzzystrmatch;"
  end
end

Now I get:

NameError (undefined local variable or method 'rank' for #<PgSearch::ScopeOptions:0x00000008965278>):

Grant Hutchins
Collaborator
Ryan Montgomery

Ok...... so I "fixed" it. So I tried accessing Heroku by running heroku run bash and then rails console. This failed because of the following error: cannot load such file — test/unit/testcase (LoadError). I wasn't really sure why that was failing at first but this stackoverflow post had a suggestion. Remove test from the .slugignore file.

I removed test from my .slugignore file and was then able to run rails console. To my surprise when I got in the rails console to debug the pg_search issue... it was gone!

So my thought is that the testcase load issue was preventing something from loading in pg_search? Maybe?

Ryan Montgomery

I'm using 0.5.7

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.