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
0
votes
0 answers

Multisearch pg_search with Rails

I have a question about multi field search using pg_search gem. What I want to do is make a query in multiples fields, so I have the following code in my Client model: pg_search_scope :search, :against => [:name, :email], :using =>…
Édipo Féderle
  • 4,169
  • 5
  • 31
  • 35
0
votes
1 answer

using pg_search with apartment gem

I'm trying to use the pg_search gem in combination with a multi tenancy application enabled by the apartment gem. Apartment seperates my data with a schema per tenant. Searching withing each tenant works well with the pg_search default settings, but…
wiiiim
  • 63
  • 6
0
votes
0 answers

How to retrieve the searched result with Pg gem multisearch

I am currently using Pg gem search in my application. Now, I want to use the pg search to search for the data across two models which are school and teacher. I created a welcome page let the audience use the search functionality there. However, at…
0
votes
3 answers

pg_search across multiple models in rails?

I'm trying to use pg_search to search across two models. I have a 'Hires' model with two columns 'child_id' and 'book_id'. I want to index the child name associated with the child_id in the 'Children' model. My model looks like this: Hire.rb class…
0
votes
1 answer

Rails 4 - PG Search not returning exact match with tags

On rails 4 with the acts as taggable gem. My search is currently not returning exact matches first. It seems to be like the tags aren't being weighted properly. When I get rid of the :associated_against => { :tags => {:name => 'D'}} exact matches…
Kathan
  • 1,428
  • 2
  • 15
  • 31
0
votes
1 answer

pg_search multisearch STI using base class

I am building a review site where users can review multiple types of businesses. The businesses are stored using STI and users have their own model. I want to implement a single search bar where people can search for users or businesses. Enter…
0
votes
2 answers

Pg Text Search~ PG::UndefinedColumn: ERROR: column documents.content does not exist

I am implmenting postgresql text search into my application. When I search for a specific item i get the error. SELECT COUNT(*) FROM "documents" INNER JOIN (SELECT "documents"."id" AS pg_search_id, (ts_rank((to_tsvector('english', …
wildrails
  • 97
  • 2
  • 11
0
votes
1 answer

How do I specify an `associated_against` an association that has an `as: ` name in pg_search?

Ok, so I have a Node model that has these associations: class Node < ActiveRecord::Base belongs_to :family_tree belongs_to :user belongs_to :media, polymorphic: true, dependent: :destroy has_many :comments, dependent: :destroy end The key…
marcamillion
  • 32,933
  • 55
  • 189
  • 380
0
votes
1 answer

Limit pg_search to the associations of an individual User object

For example: class User < ActiveRecord::Base has_many :cars end # name :string(255) class Car < ActiveRecord::Base belongs_to :user end How would you use pg_search to do a full text search of the names of cars that only a single User…
TenJack
  • 1,594
  • 4
  • 21
  • 35
0
votes
1 answer

How to use pg_search with globalize?

I use a pg_search gem for searching in my rails app. The main model in my app was: class Book < ActiveRecord::Base include PgSearch pg_search_scope :search_everywhere, against: [:author, :title, :description] end It worked perfect with @books…
0
votes
1 answer

Why am I getting different results from rails pg-search when scoping against one vs multiple fields

Here is an excerpt from my code: pg_search_scope :dynamic_fuzzy_search, -> (field, qry){ raise ArgumentError unless searchable_fields.include?(field) { :against => field, :query => qry, :using => {:trigram => {:threshold…
akvallejos
  • 329
  • 5
  • 11
0
votes
2 answers

Trigger AJAX on search (pg_search gem)

I have a search form that works well using the pg_search gem. I basically adapted it from Railscast #343. However, it always reloads the page on search, whatever I try. I have tried adding :remote => true to the form and put in a respond_to block…
Chris Butcher
  • 73
  • 1
  • 5
0
votes
0 answers

Rails 4 and pg_search GEM

I am trying to create a search form where a user will be able to enter text and the backend will run PgSearch.multisearch in order to retrieve values from a Customer and Account model. I have set up my two models according to the pg_search gem's…
HermannHH
  • 1,732
  • 1
  • 27
  • 57
0
votes
1 answer

pass array to PgSearch.multisearch

I am going to try using using PgSearch.multisearch in my app. Is there a way to pass an array to PgSearch.multisearch() method? search = PgSearch.multisearch('test1') returns a record search = PgSearch.multisearch(['test1', 'test2']) returns empty…
bonum_cete
  • 4,730
  • 6
  • 32
  • 56
0
votes
2 answers

Rails output polymorphic associations

I want to implement a search functionality in my Rails app by using the pg_search gem. I've set up everything like it says in the documentation. Then I've set up a search controller with a show action: def show @pg_search_documents =…