pg-search

PG full text search on rails using pg_search gem for substring

不问归期 提交于 2019-12-19 03:56:50
问题 I am using Pg full text search for my search . As i am using Ruby on rails, I am using pg_search gem. How do i configure it to give a hit for substring as well. pg_search_scope :search_by_detail, :against => [ [:first_name,'A'], [:last_name,'B'], [:email,'C'] ], :using => { :tsearch => {:prefix => true} } Right now it gives a hit if the substring is in the start but it wont give a hit if the substring in the middle example It gives a hit for sdate@example.com but not for example.com 回答1: I'm

How to configure a pg_search multisearch on associated models in Rails?

六眼飞鱼酱① 提交于 2019-12-18 12:31:50
问题 I'm adding pg_search into a Rails app. I'm not completely understanding the configuration, and would appreciate a gentle nudge in the right direction. First, I already have a multi model site more or less set up and running on my app. But I want to extend it to also search on associated models. For example, I have Manufacturer, Car, Model classes. Currently if I search for "Ford", only the manufacturer is returned. I'd also like to return all the associated Cars (which belong to Manufacturer)

Problems using pg_search with a polymorphic association

落爺英雄遲暮 提交于 2019-12-08 09:10:27
问题 I have the following scope for my model: class Cloth < ActiveRecord::Base include Ownerable has_many :cloth_tags, :dependent => :destroy pg_search_scope :full_search, associated_against: { cloth_tags: [:name, :brand_name] }, against: [:name, :description], ignoring: :accents, using: { tsearch: { dictionary: "spanish", any_word: true } } So if I call something like Cloth.full_search('shirt') works fine, but if I add owner: [:name] to the associated_against hash, it throws NameError:

How to enable :tsearch dictionary for pg_search multi-search?

允我心安 提交于 2019-12-07 07:49:42
问题 I'm adding pg_search into a Rails app. I'm following the instructions on github and this railscast, but I've run into a problem. I'm setting up a multi model search, and I have a basic implementation working. But I want to extend pg_seach to use its English dictionary. I already have an initializer: PgSearch.multisearch_options = { :using => [:tsearch,:trigram], :ignoring => :accents } So, from what I've read, it looks like adding the dictioary should be as simple as PgSearch.multisearch

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

蹲街弑〆低调 提交于 2019-12-06 05:12:17
问题 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 having trouble running my migrations that exceute these extensions e.g., def up execute "create extension unaccent" execute "create extension pg_trgm" end I get the impression that Heroku supports these from here https://devcenter.heroku.com

How to enable :tsearch dictionary for pg_search multi-search?

天大地大妈咪最大 提交于 2019-12-05 14:38:37
I'm adding pg_search into a Rails app. I'm following the instructions on github and this railscast , but I've run into a problem. I'm setting up a multi model search, and I have a basic implementation working. But I want to extend pg_seach to use its English dictionary. I already have an initializer: PgSearch.multisearch_options = { :using => [:tsearch,:trigram], :ignoring => :accents } So, from what I've read, it looks like adding the dictioary should be as simple as PgSearch.multisearch_options = { :using => [:tsearch => [:dictionary => "english"],:trigram], :ignoring => :accents } But when

Basic Setup for Multisearch in pg_search and Rails 3.2.3

孤人 提交于 2019-12-05 04:31:05
问题 This is my very first question here, after many months of lurking and absorbing. So I hope I do this correctly. I have been trying to get the multisearch functionality of pg_search working in my Rails 3.2.3 app after learning about the pg_search_scope functionality from this Railscast. I believe that the pg_search documentation assumes that the reader has a better working knowledge of Rails than I do. I just haven't been able to make the jump from the resources I've found to getting a working

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

不打扰是莪最后的温柔 提交于 2019-12-04 12:37:20
问题 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 pg_sear... I'm searching via ajax but i don't think that is the issue based on the output above. I'm also using will_paginate but the branch I'm using is supposed to fix previous issues with rails 4.1.x and pg_search. gem 'will_paginate', :git => 'https://github

Are there other search options for heroku

笑着哭i 提交于 2019-12-04 09:29:56
问题 I am about to launch a beta site, and heroku looks like a great option. The only think that is getting me down is that the only search option is $20/mth for the Websolr add-on. I am sure that Websolr is great, but at this very early point in this project, I rather not light up that expense. Are there any free search options to couple with heroku 's Blossom (free) plan. I feel like such a cheapskate! 回答1: This post seems to have good options: Leveraging the full text search of postgrSQL: http:

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

亡梦爱人 提交于 2019-12-03 08:20:43
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 pg_sear... I'm searching via ajax but i don't think that is the issue based on the output above. I'm also using will_paginate but the branch I'm using is supposed to fix previous issues with rails 4.1.x and pg_search. gem 'will_paginate', :git => 'https://github.com/nazgum/will_paginate.git' #until rails 4.1 will_paginate fixed This is the code model where i'm