Questions tagged [pg-search]

Ruby gem that builds ActiveRecord named scopes that take advantage of PostgreSQL's full text search.

pg_search builds ActiveRecord named scopes that take advantage of PostgreSQL's full text search.

203 questions
7
votes
1 answer

How do I search against an object's virtual attribute with pg_search?

I have a class Node that I have setup acts_as_taggable on, so I can add user_tags to any node. I also have a method on my Node model that will look up the actual User records for all the users in the user_tag_list. Here is an illustration: [32]…
marcamillion
  • 32,933
  • 55
  • 189
  • 380
7
votes
1 answer

pg_search using associated_against gives error "column [model_name].[associated_column_name] does not exist"

I'm trying to use pg_search to search through an associated model. When I run a search I get the error "PG::Error: ERROR: column plans.name does not exist". I'm running the search in the "plans" model and trying to search against association the…
6
votes
1 answer

Is there a way to use facets with the pg_search gem

I'd like to use facets in plus of standard search. Is there a way to make search results be itself "searched" with facets using pg_search? As far as I can tell, pg_search_scope are mutually exclusive (is there a workaround?). Thanks! Example: 1)…
6
votes
1 answer

Why does pg_search prefix not work like I expect?

This is my pg_search method: pg_search_scope :node_search, against: [:name, :user_id, :circa, :cached_tagged_user_names, :cached_user_tag_list], using: { tsearch: { any_word: true, dictionary: :english, prefix: true} }, :associated_against…
marcamillion
  • 32,933
  • 55
  • 189
  • 380
6
votes
1 answer

pg_search: how to prioritize exact word matches?

Probem: When searching texts with multiple occurrences of words similar to the search query they get higher rank than texts with one exact match. Example: Say search query is "productivity", then "production of organic products" gets higher rank…
vrepsys
  • 2,143
  • 4
  • 25
  • 37
6
votes
1 answer

Matching special characters (e.g. #, +) using pg_search

I'm using the pg_search gem in a Rails app to search against users - their bios and associated skill model. Users are developers, so their skills include things like "CSS", "C++", "C#", "Objective C", etc... I was initially using the the following…
Lev
  • 1,161
  • 11
  • 23
6
votes
1 answer

How to use postgres extensions on Heroku? And how to handle their migrations?

I have a Rails app that includes pg_search and queue_classic gems. Both of these make use of PostgreSQL extensions e.g., unaccent, pg_trgm and ps-something-something (sorry, not as my dev machine and can not remember). I'm deploying to Heroku, and…
Andy Harvey
  • 12,333
  • 17
  • 93
  • 185
6
votes
1 answer

Error with pg_search multisearch after initializing tsearch, trigram

I had pg_search working on my Rails 3.2.3 app using multisearch. Then I implemented the initializer provided by nertzy (author of pg_search) in this post.. Now when I run a search I get the following error: PG::Error: ERROR: operator does not…
Gruntled
  • 143
  • 9
5
votes
1 answer

Full-text search on Heroku using pg_search gem

I've implemented full-text search using pg_search gem for my Rails application My migration to create index looks like execute(<<-'eosql'.strip) CREATE index mytable_fts_idx ON mytable USING gin( (setweight(to_tsvector('english',…
membLoper
  • 1,972
  • 19
  • 21
5
votes
1 answer

pg_search gem and fulltext search rank setting

Im using the gem pg_search to perform fulltext search on my postgres db. I've a scope like this: pg_search_scope :fulltext, against: [:firstname, :lastname, :middlename], using: { tsearch: { prefix: true }, …
Pioz
  • 6,051
  • 4
  • 48
  • 67
5
votes
2 answers

pg_search exact match of search terms

When trying to find "Harrison Ford" in a document, pg_search will return any text that contains 'Harrison' and 'Ford', for example: pg_search_scope :search_by_full_name, :against => [:first_name, :last_name] People.search_by_full_name("Harrison…
Ashbury
  • 2,160
  • 3
  • 27
  • 52
5
votes
4 answers

Migration of trigram search in Rails

I have a migration: class AddGinIndexToContacts < ActiveRecord::Migration def up execute("CREATE INDEX contacts_search_idx ON contacts USING gin (first_name gin_trgm_ops, last_name gin_trgm_ops, name gin_trgm_ops)") end def down …
5
votes
3 answers

Rails 4.1.1 w/ pg_search - "PG::SyntaxError: ERROR: syntax error at or near "AS"" Bug

I updated from RoR 4.0.4 to 4.1.1 to apply the latest security patch and it appears pg_search broke. Here's a error: PG::SyntaxError: ERROR: syntax error at or near "AS" LINE 1: ...sh', ''' ' || unaccent('banner') || ' ''')), 0))) AS…
BandsOnABudget
  • 3,966
  • 2
  • 17
  • 19
5
votes
1 answer

Rails : Cannot include PgSearch Module provided by the pg_search Gem

TO SUM UP : The module PgSearch provided by the Gem pg_search cannot be included, required or loaded on the staging environment (Rbenv, nginx, unicorn,capistrano), the problem happens on the web server through http but does not appear on the…
lagrangemartin
  • 154
  • 1
  • 5
5
votes
2 answers

How to make a search results page with pg_search multisearch that has links to the results?

I finally figured out how to implement pg_search's multisearch feature. But I'm having trouble making a usable search results page that displays links back to the various articles and faqs that contain the search terms. It's a pretty basic setup…
1
2
3
13 14