Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Only matching whole words despite setting :using => {:tsearch => {:prefix => true}} #102

snoblenet opened this Issue Apr 4, 2013 · 2 comments


2 participants

I have a Reference model:

class Reference < ActiveRecord::Base
  include PgSearch
  multisearchable :against => [:source_text, :citation], :using => {:tsearch => {:prefix => true}, :ignoring => :accent}

A 9.x version of postgres:

$ psql --version
psql (PostgreSQL) 9.2.2

And a rebuilt index:

pry(main)> PgSearch::Multisearch.rebuild(Reference)

When I search on whole words, like "lorem ipsum", I get search results, but when I search on partial words, like "lore", I get no results. Why? And how can I fix this?

cgat commented Aug 8, 2013

@snoblenet the using parameter doesn't exist for multisearchable. You need to set the multisearch configuration in an initializer. Something like PgSearch.multisearch_options = { :using => { :tsearch => {:prefix => true, :dictionary => "english"} } }

That worked, thanks

@snoblenet snoblenet closed this Aug 9, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment