by

Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    Gabriele Renzi
    @riffraff
    I'm wondering: is it possible to use pg_search_scope with a virtual field?
    I.e. I have a model Rating which is related to both a User and a Book, and I'd like to perform a search of ratings given a keyword that might be in both User's fields and Book's fields. I can do that with multisearchable I believe, but that means I cannot concatenate with other Rating scopes I think
    Gabriele Renzi
    @riffraff
    basically, associated_against, but without the "you shouldn't do that" notice
    my feeling is that I need to add a redundant field in Rating which basically just denormalizes the keywords, but I'm not sure
    Grant Hutchins
    @nertzy
    @riffraff - The redundant field would probably work OK. It's going to depend a lot on the use case. The other way to do it would be something like Rating.where(foo: 'bar').my_custom_scope.joins(:pg_search_document).merge(PgSearch.multisearch('my query')). This may be able to work because PgSearch.multisearch returns a scope of PgSearch::Document records.
    Hope that helps, I know this is a several-months-late response. :-P
    Gabriele Renzi
    @riffraff
    it still appreciated, even if I don't need it anymore (in the end I just used a denormalized field) thanks :)
    Paul Tyng
    @paultyng
    I'm having some issues with my index not being used, not sure exactly what index should be created if i'm using dmetaphone as well
    my where clause looks like this (for multisearch)
    WHERE (((to_tsvector('simple', coalesce("pg_search_documents"."content"::text, ''))) @@ (to_tsquery('simple', ''' ' || 'tyng' || ' '''))) OR ((coalesce("pg_search_documents"."content"::text, '')) % 'tyng') OR ((to_tsvector('simple', pg_search_dmetaphone(coalesce("pg_search_documents"."content"::text, '')))) @@ (to_tsquery('simple', ''' ' || pg_search_dmetaphone('tyng') || ' '''))))) AS pg_search_ce9b9dd18c5c0023f2116f ON "pg_search_documents"."id" = pg_search_ce9b9dd18c5c0023f2116f.pg_search_id
    should i create a single index when multiple search types are used?
    two indexes?
    Grant Hutchins
    @nertzy
    Two indexes
    Paul Tyng
    @paultyng
    @nertzy something like:
    create index test_text_index1 on pg_search_documents using gin(((to_tsvector('simple'::regconfig, coalesce(content, ''::text))))); create index test_text_index2 on pg_search_documents using gin(((to_tsvector('simple'::regconfig, pg_search_dmetaphone(coalesce(content, ''::text))))));
    ?
    For some reason the explain doesn't seem to be using the indexes, and the query runs pretty slow
    maybe i just don't have enough rows? i guess i can test it on a bigger pg server on heroku too
    Paul Tyng
    @paultyng
    I just cannot get an index to work for multisearch
    it seems there are 3 pieces to the ranking
    only 2 are tsvectors
    sorry my postgres full text knowledge is pretty limited, so i just can't unwrap that where to indexes
    Grant Hutchins
    @nertzy
    Paul Tyng
    @paultyng
    ah i just figured it out, i was missing the trigram index, i just didn't recognize the query properly in my where
    create index test_text_index4 on pg_search_documents using gist(coalesce(content, ''::text) gist_trgm_ops)
    now its hitting indexes, all good
    Grant Hutchins
    @nertzy
    excellent!
    Paul Tyng
    @paultyng
    thanks for the help
    Grant Hutchins
    @nertzy
    sure thing
    Mohammad Abdullah
    @moeabdol
    hello
    Mohammad Abdullah
    @moeabdol
    anyone can point out how I can perform full-text search with pg_search in arabic/japanese/chinese
    Grant Hutchins
    @nertzy
    Hi @moeabdol did you see my response to your issue? Let me know if it helps, or if you have any follow-up questions.
    Denny Mueller
    @dennym
    Hey there, anyone an idea how to force a "rebuild" of the search entry for one object?
    This message was deleted
    Matt
    @beechnut
    Hi all. Does anyone have experience using the :additional_attributes option that was recently added to #multisearchable? There's no documentation on it yet.
    Also, is it possible to weight the columns referenced in #multisearchable the same way it's done in #pg_search_scope?
    Victor Justo V.
    @vjustov
    wow, i came here to ask that same question ^
    Bastian Wegge
    @bastianwegge
    Hey guys! I'm having problems figuring out how to get my search running on one hand with translations and on the other hand using has_many :through relations to the same table. Does anyone have some experience in those fields?
    Danny Tatom
    @dannytatom
    how can i restrict multi search to certain fields/columns? as an example, by default, it searches cars and trucks by color, brand, size. i want the user to be able to restrict it to search only by car color and size.
    mpdev
    @frcake
    hey all! is pg_search a good out-of-the box heroku solution?
    without needed addons
    Slim Hmidi
    @slim-hmidi
    does the pg_search extension will be used only for the ruby on rails apps?
    guillermo haas-thompson
    @memoht
    @dannytatom multisearchable :against => [:color, :size]
    @frcake Have used pg_search on Heroku for the last 4.5 years and am very happy with ease of configuration and performance I have been able to get.
    Grant Hutchins
    @nertzy
    @slim-hmidi Ruby on Rails is not strictly required, but Active Record is.
    Grant Hutchins
    @nertzy
    The GitHub repo for pg_search has disappeared! I haven't been working with the company that hosts the repo for some years so I'm guessing there was some confusion and miscommunication. I'm working to see if I can get it restored. Until then, I'm using https://github.com/nertzy/pg_search as the new home for now.
    Grant Hutchins
    @nertzy
    I forgot to send an update: the gem's GitHub home has been restored to https://github.com/Casecommons/pg_search
    Félix Fischer
    @felix91gr
    Hi, question: I am using https://github.com/Casecommons/pg_search#searching-using-different-search-features for searching with Rails Admin. However, even though it works flawlessly in local, it doesn't seem to work on deploy. Any ideas? Should I look up something in my DB or my logs to see where to debug?
    Félix Fischer
    @felix91gr
    I'm of course not asking for you to tell me what the problem is :3 but if you know what I should probably check, please do tell me :)
    Félix Fischer
    @felix91gr
    Nevermind, all we needed was to restart nginx :)
    Grant Hutchins
    @nertzy
    :+1: