1

I have a Rails 4 app with PostgreSQL database. I use PSQL default full text search for some fields, such as university_name. I need to send hundreds of full text search query at a time against my database.

Right now, I perform these queries serially, and it is very slow. Is there any way I can send text search in batch mode?

4

1 に答える 1

0

はい、tsvector columnswhich willを使用してみてください

pg_search#using-tsvector-columns

後で、通常のテキストではなく tsv_field に対して検索を実行すると、検索が高速になります。

pg_search_scope :fast_content_search,
                :against => :content,
                :using => {
                  dmetaphone: {
                    tsvector_column: 'tsvector_content_dmetaphone'
                  },
                  tsearch: {
                    dictionary: 'english',
                    tsvector_column: 'tsvector_content_tsearch'
                  }
                  trigram: {} # trigram does not use tsvectors
                }
于 2015-05-26T22:52:16.147 に答える